public ActionResult Edit([Bind(Include = "Id,catName")] ItemMainCategory category) { if (ModelState.IsValid) { db.Entry(category).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(category)); }
public ActionResult Edit([Bind(Include = "TransId,CustId,ItemId,Date,Qyt,Cost")] Bill bill) { if (ModelState.IsValid) { db.Entry(bill).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(bill)); }
public ActionResult Edit([Bind(Include = "AID,Username,Password,FName,LName,CDate,Branch")] tbl_Account tbl_Account) { if (ModelState.IsValid) { db.Entry(tbl_Account).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(tbl_Account)); }
public ActionResult Edit([Bind(Include = "UserId,Name,UserName,Password")] User user) { if (ModelState.IsValid) { db.Entry(user).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(user)); }
public ActionResult Edit([Bind(Include = "Id,Name,Desc")] Branch branch) { if (ModelState.IsValid) { db.Entry(branch).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(branch)); }
public ActionResult Edit([Bind(Include = "CustId,CustName,Tel,Type")] Customer customer) { if (ModelState.IsValid) { db.Entry(customer).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(customer)); }
public ActionResult Edit([Bind(Include = "Id,catName,MId")] ItemSubCategory itemSubCategory) { if (ModelState.IsValid) { db.Entry(itemSubCategory).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.MId = new SelectList(db.ItemMainCategories, "Id", "catName", itemSubCategory.MId); return(View(itemSubCategory)); }
public ActionResult Edit([Bind(Include = "Id,AID,RID")] tbl_Account_role tbl_Account_role) { if (ModelState.IsValid) { db.Entry(tbl_Account_role).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.AID = new SelectList(db.tbl_Account, "AID", "Username", tbl_Account_role.AID); ViewBag.RID = new SelectList(db.tbl_Role, "RID", "RoleName", tbl_Account_role.RID); return(View(tbl_Account_role)); }
public ActionResult EditDisc(Disc disc) { ManageDisc MD = new ManageDisc(); if (ModelState.IsValid) { //TODO:cheack to see if there is any previous general discount (Allbra) if (disc.Allbra) { if (MD.isAllbraActive()) //check to see if there is any previous all branches was clicked { IEnumerable <SelectListItem> braName = db.Branches.Select( b => new SelectListItem { Value = (b.Id).ToString(), Text = b.Name }); ViewBag.Branches = braName; ViewBag.ErrorMessage = "Sorry There is General Discount added before!, please checkout the discount table for more information"; return(View(disc)); } else { MD.DisableAll(); //here we are disabling all the previous dicount before adding the major discount //if there is no previous all branche is clicked then disc.Branche = 0; // add 0 in brache filed to indicate that all branches was selected db.Entry(disc).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("DiscList")); } } if (MD.getBranchById(disc.Branche, disc.status, disc.Id)) //check to see if there is a branche with previous isActive equals true { IEnumerable <SelectListItem> braName = db.Branches.Select( b => new SelectListItem { Value = (b.Id).ToString(), Text = b.Name }); ViewBag.Branches = braName; ViewBag.ErrorMessage = "Sorry The branche is all ready has an active discount added before! or there is a grand dicount is active, please checkout the discount table for more information"; return(View(disc)); } else { if (disc.Branche == null) { disc.Branche = 0; //this makes sure that the 0 value stays in the branche column for the allbra is ture or false, otherise it will be remove and a null value will palce } db.Entry(disc).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("DiscList")); } // //TODO:cheack to see if there is any previous general discount (Allbra) // if (disc.Allbra) // { // if (MD.isAllbraActive()) //check to see if there is any previous all branches was clicked // { // IEnumerable<SelectListItem> braName = db.Branches.Select( // b => new SelectListItem { Value = (b.Id).ToString(), Text = b.Name }); // ViewBag.Branches = braName; // ViewBag.ErrorMessage = "Sorry There is General Discount added before!, please checkout the discount table for more information"; // return View(disc); // } // //if there is no previous all branche is clicked then // disc.Branche = 0; // add 0 in brache filed to indicate that all branches was selected // } // db.Entry(disc).State = EntityState.Modified; // db.SaveChanges(); // return RedirectToAction("DiscList"); } return(View(disc)); }