public ActionResult Edit([Bind(Include = "CategoryId,CategoryName")] Category category)
 {
     if (ModelState.IsValid)
     {
         db.Entry(category).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(category));
 }
 public ActionResult Edit([Bind(Include = "RoleId,RoleName")] Role role)
 {
     if (ModelState.IsValid)
     {
         db.Entry(role).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(role));
 }
Exemplo n.º 3
0
 public ActionResult Edit([Bind(Include = "StoreId,StoreName,StoreLocation")] Store store)
 {
     if (ModelState.IsValid)
     {
         db.Entry(store).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(store));
 }
Exemplo n.º 4
0
 public ActionResult Edit([Bind(Include = "ProductId,ProductName,Price,CategoryId,Image,Description,UnitsInOrder")] Product product)
 {
     if (ModelState.IsValid)
     {
         db.Entry(product).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.CategoryId = new SelectList(db.Categories, "CategoryId", "CategoryName", product.CategoryId);
     return(View(product));
 }
 public ActionResult Edit([Bind(Include = "SalePersonId,SalePersonName,SalePersonPhone,RoleId,UserId,Password,StoreId")] SalePerson salePerson)
 {
     if (ModelState.IsValid)
     {
         db.Entry(salePerson).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.RoleId  = new SelectList(db.Roles, "RoleId", "RoleName", salePerson.RoleId);
     ViewBag.StoreId = new SelectList(db.Stores, "StoreId", "StoreName", salePerson.StoreId);
     return(View(salePerson));
 }
Exemplo n.º 6
0
 public ActionResult Edit([Bind(Include = "OrderId,OrderDate,CustomerName,CustomerPhone,StoreId,SalePersonId")] Order order)
 {
     if (ModelState.IsValid)
     {
         db.Entry(order).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.SalePersonId = new SelectList(db.SalePersons, "SalePersonId", "SalePersonName", order.SalePersonId);
     ViewBag.StoreId      = new SelectList(db.Stores, "StoreId", "StoreName", order.StoreId);
     return(View(order));
 }
Exemplo n.º 7
0
 public ActionResult Edit([Bind(Include = "OrderDetailId,OrderId,ProductId,Price,Quantity")] OrderDetail orderDetail)
 {
     if (ModelState.IsValid)
     {
         db.Entry(orderDetail).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.OrderId   = new SelectList(db.Orders, "OrderId", "CustomerName", orderDetail.OrderId);
     ViewBag.ProductId = new SelectList(db.Products, "ProductId", "ProductName", orderDetail.ProductId);
     return(View(orderDetail));
 }