Пример #1
0
 public ActionResult Edit([Bind(Include = "SupplierID,rowguid,Name,Code,CompanyName,NRC,NIT,CreationDate,CreatedBy,ModifiedDate,ModifiedBy")] Supplier supplier)
 {
     if (ModelState.IsValid)
     {
         db.Entry(supplier).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(supplier));
 }
Пример #2
0
 public ActionResult MenuEdit([Bind(Include = "MenuID,DisplayName,ParentMenuID,OrderNumber,MenuURL,MenuIcon")] Menu menu)
 {
     if (ModelState.IsValid)
     {
         db.Entry(menu).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(menu));
 }
Пример #3
0
 public ActionResult Edit([Bind(Include = "ArsId,ArsCodigo,ArsNombre,ArsActivo,InstitucionId,ArsUsuarioRegistra,ArsFechaRegistro,ArsUsuarioModifica,ArsFechaModifica")] Ars ars)
 {
     if (ModelState.IsValid)
     {
         db.Entry(ars).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(ars));
 }
Пример #4
0
 public ActionResult Edit([Bind(Include = "ComponentID,Code,Description,ComponentCategoryID,UomID,CustomerID,CustomerCode,CountryOfOrigin,SupplierID,SupplierCode,Description2,PurchasingPrice,PurchasingTerms,ListPrice,HtsID,SacID,IsActive,DiscontinuedDate,CreationDate,CreatedBy,ModifiedDate,ModifiedBy,rowguid")] Component component)
 {
     if (ModelState.IsValid)
     {
         db.Entry(component).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.ComponentCategoryID = new SelectList(db.ComponentCategory, "ComponentCategoryID", "Name", component.ComponentCategoryID);
     ViewBag.CustomerID          = new SelectList(db.Customer, "CustomerID", "CreatedBy", component.CustomerID);
     ViewBag.SupplierID          = new SelectList(db.Supplier, "SupplierID", "Name", component.SupplierID);
     ViewBag.UomID = new SelectList(db.UnitMeasure, "UomID", "Code", component.UomID);
     return(View(component));
 }
Пример #5
0
 public ActionResult ColorEdit([Bind(Include = "ColorID,Name")] Colors color)
 {
     color.ModifiedDate = DateTime.Now.Date;
     if (ModelState.IsValid)
     {
         db.Entry(color).State = EntityState.Modified;
         var item = from a in db.Colors
                    where a.Name == color.Name
                    select a;
         if (item.Count() == 0)
         {
             try
             {
                 db.SaveChanges();
                 TempData["ResultMessage"] = "El Registro se actualizó correctamente";
                 TempData["ResultType"]    = "S";
                 return(RedirectToAction("ColorIndex"));
             }
             catch (Exception ex)
             {
                 TempData["ResultMessage"] = "El Registro no se pudo actualizar. " + ex.Message;
                 TempData["ResultType"]    = "E";
                 return(RedirectToAction("ColorIndex"));
                 //throw;
             }
         }
         else
         {
             TempData["ResultMessage"] = "El Registro no se pudo actualizar. Ya existe un registro con ese nombre ";
             TempData["ResultType"]    = "E";
             return(RedirectToAction("ColorIndex"));
         }
     }
     return(RedirectToAction("ColorIndex"));
     //return PartialView("_ColorEdit", color);
 }
Пример #6
0
 public ActionResult CategoryEdit([Bind(Include = "ComponentCategoryID,Name,Description,ModifiedDate,CreationDate,rowguid,CreatedBy")] ComponentCategory category)
 {
     category.ModifiedDate = DateTime.Now.Date;
     category.ModifiedBy   = User.Identity.GetUserId();
     if (ModelState.IsValid)
     {
         db.Entry(category).State = EntityState.Modified;
         var item = from a in db.Colors
                    where a.Name == category.Name
                    select a;
         if (item.Count() == 0)
         {
             try
             {
                 db.SaveChanges();
                 TempData["ResultMessage"] = "El Registro se actualizó correctamente";
                 TempData["ResultType"]    = "S";
                 return(RedirectToAction("CategoryIndex"));
             }
             catch (Exception ex)
             {
                 TempData["ResultMessage"] = "El Registro no se pudo actualizar. " + ex.Message;
                 TempData["ResultType"]    = "E";
                 return(RedirectToAction("CategoryIndex"));
                 //throw;
             }
         }
         else
         {
             TempData["ResultMessage"] = "El Registro no se pudo actualizar. Ya existe un registro con ese nombre ";
             TempData["ResultType"]    = "E";
             return(RedirectToAction("CategoryIndex"));
         }
     }
     return(RedirectToAction("CategoryIndex"));
 }