Browse Source

zwischenstand (noch nicht funktionsfähig)

Felix_TestBranch
Naumann 2 years ago
parent
commit
c489070a52
  1. 30
      Controllers/CatalogueController.cs
  2. 20
      Data/KatalogRepo.cs
  3. 6
      Models/Book.cs
  4. 8
      Models/LendTypeEnum.cs
  5. 5
      Models/Magazin.cs

30
Controllers/CatalogueController.cs

@ -0,0 +1,30 @@
using System.Collections.Generic;
using BuecherwurmAPI.Models;
using Microsoft.AspNetCore.Mvc;
namespace BuecherwurmAPI.Controllers
{
[Route("katalog") ]
[ApiController]
public class KatalogController
{
private readonly object _repository;
/*[HttpGet]
public ActionResult<IEnumerable<Book>> GetAllBooks()
{
}*/
[HttpGet("{id}", Name ="GetBookByID")]
public ActionResult <IEnumerable<Book>> GetBookByID(int id)
{
var bookItem = _repository.GetBookByID(id);
if (bookItem != null)
{
return
}
}
}
}

20
Data/KatalogRepo.cs

@ -0,0 +1,20 @@
using System.Collections.Generic;
using BuecherwurmAPI.Models;
namespace BuecherwurmAPI.Data
{
public class KatalogRepo
{
private readonly object _context;
public IEnumerable<Book> GetAllBooks()
{
//return _context.Book.ToList();
}
/*public Book GetBookById(int id)
{
return _context.FirstOrDefault(p => p.Id == id);
}*/
}
}

6
Models/Buch_Command.cs → Models/Book.cs

@ -1,3 +1,5 @@
using System.ComponentModel.DataAnnotations;
namespace BuecherwurmAPI.Models
{
public class Book
@ -9,11 +11,13 @@ namespace BuecherwurmAPI.Models
public string Language {get; set;}
public int Pages {get; set;}
public int Year {get; set;}
[Key]
[Required]
public int ProductId { get; set; }
public CategoryEnum Category { get; set; }
public string ImageLink { get; set; }
public int LendTime {get; set;}
// public LendTypeEnum LendType {get; set;}
public LendTypeEnum LendType {get; set;}
}
}

8
Models/LendTypeEnum.cs

@ -0,0 +1,8 @@
namespace BuecherwurmAPI
{
public enum LendTypeEnum
{
Physical,
Virtual
}
}

5
Models/Magazin_Command.cs → Models/Magazin.cs

@ -1,6 +1,6 @@
namespace BuecherwurmAPI.Models
{
public class Magazine
public class Magazin
{
public int ProductId {get; set;}
public CategoryEnum Category {get; set;}
@ -9,8 +9,7 @@ namespace BuecherwurmAPI.Models
public string Run {get; set;}
public string Audience {get; set;}
public string Topic {get; set;}
// public LendTypeEnum LendType {get; set;}
public LendTypeEnum LendType {get; set;}
}
}
Loading…
Cancel
Save