BuecherwurmAPI/Controllers/LendController.cs

35 lines
923 B
C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using BuecherwurmAPI.Data;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Logging;
using BuecherwurmAPI.Models;
namespace BuecherwurmAPI.Controllers
{
[Route("api/leihvorgang")]
[ApiController]
public class LendController : ControllerBase
{
private readonly MockLendRepo _mockLendRepo = new MockLendRepo();
//GET api/leihvorgang/
[HttpGet]
public ActionResult<IEnumerable<Lend>> GetAllLends()
{
var lends = _mockLendRepo.GetAllLends();
return Ok(lends);
}
//GET api/leihvorgang/{id}
[HttpGet("{id}")]
public ActionResult<Lend> GetLend(int id)
{
var lend = _mockLendRepo.GetLendById(id);
return Ok(lend);
}
}
}