public void editAlcohol(int id, AlcoholDTO Alco) { var alc = _repo.GetById(id).FirstOrDefault(); alc.ABV = Alco.ABV; alc.Brand = Alco.Brand; alc.Style = Alco.Style; alc.Type = Alco.Type; _repo.Edit(alc); }
//Add public void Add(AlcoholDTO alcoholDTO) { var alcohol = new Alcohol { ABV = alcoholDTO.ABV, Brand = alcoholDTO.Brand, Style = alcoholDTO.Style, Type = alcoholDTO.Type }; _repo.Add(alcohol); }
public IActionResult Post([FromBody] AlcoholDTO alcDTO) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } //if (_service.Check(User.Identity.Name) == false) //{ // return BadRequest("Too many Favorites (max. 4)"); //} else { _service.AddFav(alcDTO.Id, User.Identity.Name); return(Ok()); } }
public void Post(string volume, [FromBody] AlcoholDTO alcDto) { _service.Add(User.Identity.Name, volume, alcDto.Id); }
public void Put(int id, [FromBody] AlcoholDTO value) { _service.editAlcohol(id, value); }
public void Post([FromBody] AlcoholDTO alcohol) { _service.Add(alcohol); }