public ActionResult Edit(Ingredient i) { try { if (!ModelState.IsValid) { return(View()); } using (var db = new Nu34lifeEntities()) { Ingredient ing = db.Ingredients.Find(i.Id); ing.Name = i.Name; ing.Description = i.Description; ing.Protein = i.Protein; ing.Carbohydrates = i.Carbohydrates; ing.Cholesterol = i.Cholesterol; ing.Fat = i.Fat; ing.Potasium = i.Potasium; db.SaveChanges(); return(RedirectToAction("Index")); } } catch (Exception ex) { throw; } }
public ActionResult ListaState() { using (var db = new Nu34lifeEntities()) { return(PartialView(db.States.ToList())); } }
public ActionResult ListaNutritionist() { using (var db = new Nu34lifeEntities()) { return(PartialView(db.Nutritionists.ToList())); } }
public ActionResult List_Instructions() { using (var db = new Nu34lifeEntities()) { return(PartialView(db.Instructions.ToList())); } }
public ActionResult Edit(Nutritionist n) { try { if (!ModelState.IsValid) { return(View()); } using (var db = new Nu34lifeEntities()) { Nutritionist nu = db.Nutritionists.Find(n.Id); nu.Name = n.Name; nu.LastName = n.LastName; nu.Password = n.Password; nu.Email = n.Email; nu.Birthday = n.Birthday; nu.Validate = n.Validate; db.SaveChanges(); return(RedirectToAction("Index")); } } catch (Exception ex) { throw; } }
public ActionResult Edit(State s) { try { if (!ModelState.IsValid) { return(View()); } using (var db = new Nu34lifeEntities()) { State st = db.States.Find(s.Id); st.Nutritionist_Id = s.Nutritionist_Id; st.Patient_Id = s.Patient_Id; st.Description = s.Description; st.Weighr = s.Weighr; st.Height = s.Height; st.Glucose = s.Glucose; st.Affiliate = s.Affiliate; st.Generated_day = s.Generated_day; st.Expiration = s.Expiration; db.SaveChanges(); return(RedirectToAction("Index")); } } catch (Exception ex) { throw; } }
public ActionResult Edit(Membership m) { try { if (!ModelState.IsValid) { return(View()); } using (var db = new Nu34lifeEntities()) { Membership me = db.Memberships.Find(m.Id); me.Name = m.Name; me.Description = m.Description; me.Duration = m.Duration; me.Amount = m.Amount; db.SaveChanges(); return(RedirectToAction("Index")); } } catch (Exception ex) { throw; } }
public ActionResult Edit(Allergy d) { try { if (!ModelState.IsValid) { return(View()); } using (var db = new Nu34lifeEntities()) { Allergy all = db.Allergies.Find(d); all.Description = d.Description; all.Ingredient_Id = d.Ingredient_Id; all.Patient_Id = d.Patient_Id; db.SaveChanges(); return(RedirectToAction("Index")); } } catch (Exception ex) { throw; } }
public ActionResult Create() { var db = new Nu34lifeEntities(); ViewBag.nutritionist = nutritionistService.Listar(); return(View()); }
public bool Insertar(Allergy a) { var db = new Nu34lifeEntities(); db.Allergies.Add(a); db.SaveChanges(); return(true); }
public ActionResult Details(int id) { using (var db = new Nu34lifeEntities()) { Ingredient i = db.Ingredients.Find(id); return(View(i)); } }
public ActionResult Details(int id) { using (var db = new Nu34lifeEntities()) { Drug i = db.Drugs.Find(id); return(View(i)); } }
public ActionResult Details(int id) { using (var db = new Nu34lifeEntities()) { State s = db.States.Find(id); return(View(s)); } }
public ActionResult Details(int id) { using (var db = new Nu34lifeEntities()) { Nutritionist n = db.Nutritionists.Find(id); return(View(n)); } }
public ActionResult Details(int id) { using (var db = new Nu34lifeEntities()) { Allergy i = db.Allergies.Find(id); return(View(i)); } }
public ActionResult Details(int id) { using (var db = new Nu34lifeEntities()) { Membership i = db.Memberships.Find(id); return(View(i)); } }
public bool Insertar(Recipe a) { var db = new Nu34lifeEntities(); db.Recipes.Add(a); db.SaveChanges(); return(true); }
public bool Insertar(Instruction a) { var db = new Nu34lifeEntities(); db.Instructions.Add(a); db.SaveChanges(); return(true); }
public bool Insertar(Nutritionist a) { var db = new Nu34lifeEntities(); db.Nutritionists.Add(a); db.SaveChanges(); return(true); }
public bool Insertar(Plan a) { var db = new Nu34lifeEntities(); db.Plans.Add(a); db.SaveChanges(); return(true); }
public bool Insertar(Ingredient a) { var db = new Nu34lifeEntities(); db.Ingredients.Add(a); db.SaveChanges(); return(true); }
public ActionResult Delete(int id) { using (var db = new Nu34lifeEntities()) { Nutritionist n = db.Nutritionists.Find(id); db.Nutritionists.Remove(n); db.SaveChanges(); return(RedirectToAction("Index")); } }
public ActionResult Delete(int id) { using (var db = new Nu34lifeEntities()) { Membership m = db.Memberships.Find(id); db.Memberships.Remove(m); db.SaveChanges(); return(RedirectToAction("Index")); } }
public ActionResult Delete(int id) { using (var db = new Nu34lifeEntities()) { State s = db.States.Find(id); db.States.Remove(s); db.SaveChanges(); return(RedirectToAction("Index")); } }
// GET: Drug public ActionResult Index() { try { using (var db = new Nu34lifeEntities()) { return(View(db.Drugs.ToList())); } } catch (Exception) { throw; } }
// GET: Instruction public ActionResult Index() { try { using (var db = new Nu34lifeEntities()) { var instructions = db.Instructions.Include(i => i.Recipe); return(View(instructions.ToList())); } } catch (Exception) { throw; } }
public ActionResult Details(int?id) { if (id == null) { return(RedirectToAction("Index")); } else { using (var db = new Nu34lifeEntities()) { Instruction i = db.Instructions.Find(id); return(View(i)); } } }
public ActionResult Authorize(Nu34life.Models.Nutritionist nutritionistModel) { using (var db = new Nu34lifeEntities()) { var nutritionistDetails = db.Nutritionists.Where(x => x.Email == nutritionistModel.Email && x.Password == nutritionistModel.Password).FirstOrDefault(); if (nutritionistDetails == null) { return(View("Index", nutritionistModel)); } else { Session["Email"] = nutritionistDetails.Email; return(RedirectToAction("Index", "Home")); } } }
public ActionResult Edit(int id) { using (var db = new Nu34lifeEntities()) { try { //Nutritionist nu = db.Nutritionists.Where(n => n.Id == id).FirstOrDefault(); State s = db.States.Find(id); return(View(s)); } catch (Exception ex) { throw; } } }
public ActionResult Create(Drug d) { if (!ModelState.IsValid) { return(View()); } try { using (var db = new Nu34lifeEntities()) { db.Drugs.Add(d); db.SaveChanges(); return(RedirectToAction("Index")); } } catch (Exception ex) { ModelState.AddModelError("Error al agregar el Medicamento", ex); return(View()); } }