Beispiel #1
0
        public ActionResult Delete(string id)
        {
            mFoodMenuItems item = FoodItemRepository.Remove(id);

            if (item == null)
            {
                return(NotFound());
            }

            return(Ok());
        }
Beispiel #2
0
        public ActionResult <mFoodMenuItems> GetItem(string id)
        {
            mFoodMenuItems item = FoodItemRepository.Get(id);

            if (item == null)
            {
                return(NotFound());
            }

            return(item);
        }
Beispiel #3
0
 public ActionResult Edit([FromBody] mFoodMenuItems item)
 {
     try
     {
         FoodItemRepository.Update(item);
     }
     catch (Exception)
     {
         return(BadRequest("Error while editing item"));
     }
     return(NoContent());
 }
Beispiel #4
0
 public ActionResult <mFoodMenuItems> Create([FromBody] mFoodMenuItems item)
 {
     FoodItemRepository.Add(item);
     return(CreatedAtAction(nameof(GetItem), new { item.ID }, item));
 }
Beispiel #5
0
 public void Update(mFoodMenuItems item)
 {
     FoodMenuItems[item.ID] = item;
 }
Beispiel #6
0
 public void Add(mFoodMenuItems item)
 {
     item.ID = Guid.NewGuid().ToString();
     FoodMenuItems[item.ID] = item;
 }