diff --git a/Controllers/CatalogueController.cs b/Controllers/CatalogueController.cs new file mode 100644 index 0000000..12f0cb2 --- /dev/null +++ b/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> GetAllBooks() +{ + +}*/ + + [HttpGet("{id}", Name ="GetBookByID")] + public ActionResult > GetBookByID(int id) + { + var bookItem = _repository.GetBookByID(id); + if (bookItem != null) + { + return + } + } + } + +} \ No newline at end of file diff --git a/Data/KatalogRepo.cs b/Data/KatalogRepo.cs new file mode 100644 index 0000000..44750aa --- /dev/null +++ b/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 GetAllBooks() + { + //return _context.Book.ToList(); + } + + /*public Book GetBookById(int id) + { + return _context.FirstOrDefault(p => p.Id == id); + }*/ + } +} \ No newline at end of file diff --git a/Models/Buch_Command.cs b/Models/Book.cs similarity index 80% rename from Models/Buch_Command.cs rename to Models/Book.cs index 48ed91d..5304bdc 100644 --- a/Models/Buch_Command.cs +++ b/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;} } } \ No newline at end of file diff --git a/Models/LendTypeEnum.cs b/Models/LendTypeEnum.cs new file mode 100644 index 0000000..3fdbcb2 --- /dev/null +++ b/Models/LendTypeEnum.cs @@ -0,0 +1,8 @@ +namespace BuecherwurmAPI +{ + public enum LendTypeEnum + { + Physical, + Virtual + } +} \ No newline at end of file diff --git a/Models/Magazin_Command.cs b/Models/Magazin.cs similarity index 81% rename from Models/Magazin_Command.cs rename to Models/Magazin.cs index 0d73e09..20cbebd 100644 --- a/Models/Magazin_Command.cs +++ b/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;} } }