示例#1
0
        public IActionResult Get([FromQuery] FavouriteDishKey id)
        {
            FavouriteDish dish = db.GetEntity(id);

            if (dish == null)
            {
                return(NotFound());
            }
            return(new ObjectResult(dish));
        }
示例#2
0
        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));
        }