public ActionResult Edit([Bind(Include = "ID_PRODUCTO,NOMBRE,ES_COMBO,ACTIVE,WHOLESALE_PRICE,SALE_PRICE,PESO_UNIDADES")] PRODUCTO pRODUCTO) { if (ModelState.IsValid) { db.Entry(pRODUCTO).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(pRODUCTO)); }
public ActionResult Edit([Bind(Include = "ID_PACKAGING,IMAGE,NAME,UNIT_PRICE,WHOLESALE_PRICE,ACTIVE")] PACKAGING pACKAGING) { if (ModelState.IsValid) { db.Entry(pACKAGING).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(pACKAGING)); }
public ActionResult Edit([Bind(Include = "ID_INSUMO_PACKAGING,ID_INSUMO,ID_PACKAGING,QUANTITY,maxPerson,minPerson,ACTIVE")] INSUMO_PACKAGING iNSUMO_PACKAGING) { if (ModelState.IsValid) { iNSUMO_PACKAGING.ACTIVE = 1; db.Entry(iNSUMO_PACKAGING).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.ID_INSUMO = new SelectList(db.INSUMOes, "ID_INSUMO", "NOMBRE", iNSUMO_PACKAGING.ID_INSUMO); ViewBag.ID_PACKAGING = new SelectList(db.PACKAGINGs, "ID_PACKAGING", "NAME", iNSUMO_PACKAGING.ID_PACKAGING); return(View(iNSUMO_PACKAGING)); }
public ActionResult Edit([Bind(Include = "ID_USER_SUPPLIER,ID_USER_SUPPLIER_INSUMO,UNIT_WEIGHT,ID_MEDIDA_PACKAGE,ID_CUSTOM_UNIT,NAME,PRICE,QUANTITY_PACKAGE,IS_BOX,IS_PACKAGE,QUANTITY_BOX,QUANTITY,CODE")] USER_SUPPLIER_INSUMO iNSUMO) { if (ModelState.IsValid) { var idUser = User.Identity.GetUserId(); iNSUMO.ID_USER = idUser; iNSUMO.ACTIVE = true; if (iNSUMO.QUANTITY == null) { iNSUMO.QUANTITY = 1; } bool isBox = false; decimal individualPrice; if (iNSUMO.IS_BOX == true) { isBox = true; decimal totalQuantity = Convert.ToDecimal((iNSUMO.QUANTITY * iNSUMO.QUANTITY_BOX)); individualPrice = Convert.ToDecimal(iNSUMO.PRICE / totalQuantity); } else { individualPrice = Convert.ToDecimal(iNSUMO.PRICE / iNSUMO.QUANTITY); } iNSUMO.INDIVIDUAL_PRICE = individualPrice; db.Entry(iNSUMO).State = EntityState.Modified; db.SaveChanges(); Success(String.Format("The ingredient {0} was updated correctly.", iNSUMO.NAME)); return(RedirectToAction("Index")); } ViewBag.ID_MEDIDA_PACKAGE = new SelectList(db.MEDIDAs, "ID_MEDIDA", "NOMBRE", iNSUMO.ID_MEDIDA_PACKAGE); ViewBag.ID_CUSTOM_UNIT = new SelectList(db.CUSTOM_UNIT, "ID_CUSTOM_UNIT", "NAME", iNSUMO.ID_MEDIDA_PACKAGE); ViewBag.ID_USER_SUPPLIER = new SelectList(db.USER_SUPPLIER, "ID_USER_SUPPLIER", "NAME", iNSUMO.ID_USER_SUPPLIER); IEnumerable <ModelError> allErrors = ModelState.Values.SelectMany(v => v.Errors); StringBuilder str = new StringBuilder(); str.AppendLine("The following error has ocurred: <br/>"); str.AppendLine("<ul>"); foreach (var it in allErrors) { str.AppendLine("<li>" + it.ErrorMessage.ToString() + "</li>"); } str.AppendLine("</ul>"); Danger(str.ToString(), true); return(View(iNSUMO)); }
public ActionResult Create([Bind(Include = "ID_ORDER,ID_SUPPLIER,ORDER_DATE,DELIVERED,IS_DRAFT,ACTIVE")] ORDER ORDER) { if (ModelState.IsValid) { db.Entry(ORDER).State = EntityState.Modified; db.SaveChanges(); SendEmail("*****@*****.**", ORDER.ID_ORDER); return(RedirectToAction("Index")); } MailManager mm = new MailManager(); ViewBag.ID_SUPPLIER = new SelectList(db.SUPPLIERs, "ID_SUPPLIER", "NAME", ORDER.ID_SUPPLIER); return(View(ORDER)); }
public ActionResult Edit([Bind(Include = "ID_CUSTOM_UNIT,ID_PORTIONED_BY,NAME,QUANTITY,ACTIVE")] CUSTOM_UNIT cUSTOM_UNIT) { if (ModelState.IsValid) { db.Entry(cUSTOM_UNIT).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.ID_PORTIONED_BY = new SelectList(db.MEDIDAs, "ID_MEDIDA", "NOMBRE", cUSTOM_UNIT.ID_PORTIONED_BY); return(View(cUSTOM_UNIT)); }
public ActionResult Edit([Bind(Include = "ID_CATEGORY,ID_CATEGORY_TYPE,ACTIVE,NAME")] CATEGORY cATEGORY) { if (ModelState.IsValid) { db.Entry(cATEGORY).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.ID_CATEGORY_TYPE = new SelectList(db.CATEGORY_TYPE, "ID_CATEGORY_TYPE", "NAME", cATEGORY.ID_CATEGORY_TYPE); return(View(cATEGORY)); }
public ActionResult Edit([Bind(Include = "ID_CLIENT,NAME,SURNAME,HOME_NUMBER,MOBILE_NUMBER,EMAIL")] ClientViewModel cLIENT) { if (ModelState.IsValid) { CLIENT cliente = new CLIENT { NAME = cLIENT.NAME, SURNAME = cLIENT.SURNAME, HOME_NUMBER = cLIENT.HOME_NUMBER, MOBILE_NUMBER = cLIENT.MOBILE_NUMBER, EMAIL = cLIENT.EMAIL, ID_CLIENT = cLIENT.ID_CLIENT, }; cliente.ACTIVE = true; cliente.DELETED = false; db.Entry(cliente).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(cLIENT)); }
public ActionResult Edit([Bind(Include = "ID_MENU,NOMBRE,ACTIVE")] MENU mENU, double COST) { if (ModelState.IsValid) { mENU.ACTIVE = true; mENU.COST = Convert.ToDecimal(COST); db.Entry(mENU).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(mENU)); }
public ActionResult Edit([Bind(Include = "ID_CATERING,ID_CLIENT,ID_MENU,AMOUNT_PEOPLE,ADDRESS,EVENT_DATE,EVENT_TIME,NOTES,HAS_PARKING,DELETED")] CATERING cATERING) { if (ModelState.IsValid) { cATERING.deleted = 0; db.Entry(cATERING).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.ID_CLIENT = new SelectList(db.CLIENTs, "ID_CLIENT", "NAME", cATERING.ID_CLIENT); ViewBag.ID_MENU = new SelectList(db.MENUs, "ID_MENU", "NOMBRE", cATERING.ID_MENU); return(View(cATERING)); }
public ActionResult Edit([Bind(Include = "ID_RECIPE,ID_CATEGORY,ID_MEDIDA_YIELD,ID_MEDIDA_PORTION,ID_PREP_TIME,ID_COOK_TIME,ID_SHELF_TIME,YIELD,PORTION_SIZE,PORTION_NUMBER,PRICE,PREP_TIME,COOK_TIME,SHELF_LIFE,IMAGEN,NAME,ACTIVE")] RECIPE rECIPE) { if (ModelState.IsValid) { db.Entry(rECIPE).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } var idUser = User.Identity.GetUserId(); ViewBag.ID_USER_SUPPLIER_INSUMO = new SelectList(db.USER_SUPPLIER_INSUMO.Where(x => x.ID_USER == idUser && x.ACTIVE == true).ToList(), "ID_USER_SUPPLIER_INSUMO", "NAME"); ViewBag.ID_MEDIDA_YIELD = new SelectList(db.MEDIDAs, "ID_MEDIDA", "NOMBRE", rECIPE.ID_MEDIDA_YIELD); ViewBag.ID_MEDIDA_PORTION = new SelectList(db.MEDIDAs, "ID_MEDIDA", "NOMBRE", rECIPE.ID_MEDIDA_PORTION); ViewBag.ID_CATEGORY = new SelectList(db.CATEGORies.Where(x => x.ID_CATEGORY == 4), "ID_CATEGORY", "NAME", rECIPE.ID_CATEGORY); ViewBag.ID_COOK_TIME = new SelectList(db.CATEGORies, "ID_CATEGORY", "NAME", rECIPE.ID_COOK_TIME); ViewBag.ID_PREP_TIME = new SelectList(db.CATEGORies, "ID_CATEGORY", "NAME", rECIPE.ID_PREP_TIME); ViewBag.ID_SHELF_TIME = new SelectList(db.CATEGORies, "ID_CATEGORY", "NAME", rECIPE.ID_SHELF_TIME); return(View(rECIPE)); }