Пример #1
0
        public ActionResult DeleteConfirmed(int id)
        {
            DietDetail dietDetail = db.DietDetails.Find(id);

            db.DietDetails.Remove(dietDetail);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Пример #2
0
 public ActionResult Edit([Bind(Include = "Id,Meal,FoodMenu,Note,Date,DietId")] DietDetail dietDetail)
 {
     if (ModelState.IsValid)
     {
         db.Entry(dietDetail).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.DietId = new SelectList(db.Diets, "Id", "DietTitle", dietDetail.DietId);
     return(View(dietDetail));
 }
Пример #3
0
        // GET: DietDetails/Details/5
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            DietDetail dietDetail = db.DietDetails.Find(id);

            if (dietDetail == null)
            {
                return(HttpNotFound());
            }
            return(View(dietDetail));
        }
        public IHttpActionResult ViewFriendsDiets(string friendId)
        {
            if (friendId is null)
            {
                return(BadRequest("Please enter a valid Friend Id. "));
            }
            if (ModelState.IsValid)
            {
                DietDetail friendsDiet = friendsService.ViewFriendsDietPlan(friendId);

                return(Ok(friendsDiet.Name));
            }

            return(BadRequest());
        }
Пример #5
0
        // GET: DietDetails/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            DietDetail dietDetail = db.DietDetails.Find(id);

            if (dietDetail == null)
            {
                return(HttpNotFound());
            }
            ViewBag.DietId = new SelectList(db.Diets, "Id", "DietTitle", dietDetail.DietId);
            return(View(dietDetail));
        }