public IActionResult Get([FromQuery] FavouriteDishKey id) { FavouriteDish dish = db.GetEntity(id); if (dish == null) { return(NotFound()); } return(new ObjectResult(dish)); }
public IActionResult Delete([FromQuery] FavouriteDishKey id) { string userJWTId = User.FindFirst("id")?.Value; Customer customer = db.GetCustomer(userJWTId); if (customer != null) { id.CustomerId = customer.Id; } FavouriteDish dish = db.GetEntity(id); if (dish == null) { return(NotFound()); } db.Delete(id); db.Save(); return(Ok(dish)); }