zwischenstand (noch nicht funktionsfähig)

This commit is contained in:
Naumann 2020-05-27 11:21:39 +02:00
parent a543c8c1bd
commit c489070a52
5 changed files with 65 additions and 4 deletions

View File

@ -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 Normal file
View File

@ -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);
}*/
}
}

View File

@ -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 Normal file
View File

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

View File

@ -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;}
}
}