예제 #1
0
        public ActionResult Edit(MealModel mm)
        {
            if (Session["UserID"] != null && Session["UserType"].ToString().ToLower() == "chef")
            {
                if (mm != null)
                {
                    Meal mU = mRepo.GetByID(mm.ID);
                    mU.Name        = mm.Name;
                    mU.PhotoPath   = mm.PhotoPath;
                    mU.Price       = mm.Price;
                    mU.Stock       = mm.Quantity;
                    mU.Description = mm.Description;

                    mRepo.Update(mU);
                    return(RedirectToAction("Index", "Chef"));
                }
            }

            return(RedirectToAction("Login", "Home", new { area = "" }));
        }
예제 #2
0
        public ActionResult <Meal> Put(int id, Meal entity)
        {
            _repository.Update(id, entity);

            return(Ok(entity));
        }