public ActionResult Edit([Bind(Include = "ID,CustomerName,OrderNumber,Date,Description")] Customer customer) { if (Session["type"] == null || Session["type"].ToString() == "") { Session["DefaultView"] = "Edit"; Session["DefaultControll"] = "Customer"; return(RedirectToAction("Login", "Employee")); } if (ModelState.IsValid) { db.Entry(customer).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(customer)); }
public ActionResult Edit([Bind(Include = "ID,BrandName,Origin")] Brand brand) { if (Session["type"] == null || Session["type"].ToString() == "") { Session["DefaultView"] = "Edit"; Session["DefaultControll"] = "Brand"; return(RedirectToAction("Login", "Employee")); } if (ModelState.IsValid) { db.Entry(brand).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(brand)); }
public ActionResult Edit([Bind(Include = "ID,UnitName,UnitDescription,UnitPrimaryQty")] Unit unit) { if (Session["type"] == null || Session["type"].ToString() == "") { Session["DefaultView"] = "Edit"; Session["DefaultControll"] = "Unit"; return(RedirectToAction("Login", "Employee")); } if (ModelState.IsValid) { db.Entry(unit).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(unit)); }
public ActionResult Edit([Bind(Include = "ID,ProductID,ProductPrice1")] ProductPrice productPrice) { if (Session["type"] == null || Session["type"].ToString() == "") { Session["DefaultView"] = "Edit"; Session["DefaultControll"] = "ProductPrice"; return(RedirectToAction("Login", "Employee")); } if (ModelState.IsValid) { db.Entry(productPrice).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.ProductID = new SelectList(db.Products, "ID", "ProductName", productPrice.ProductID); return(View(productPrice)); }
public ActionResult Edit([Bind(Include = "EmployeeID")] EmployeeAdmin employeeAdmin) { if (Session["type"] == null || Session["type"].ToString() == "") { Session["DefaultView"] = "Edit"; Session["DefaultControll"] = "EmployeeAdmin"; return(RedirectToAction("Login", "Employee")); } if (ModelState.IsValid) { db.Entry(employeeAdmin).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.EmployeeID = new SelectList(db.Employees, "ID", "EmployeeName", employeeAdmin.EmployeeID); return(View(employeeAdmin)); }
public ActionResult Edit([Bind(Include = "ID,CityName,CountryID")] City city) { if (Session["type"] == null || Session["type"].ToString() == "") { Session["DefaultView"] = "Edit"; Session["DefaultControll"] = "City"; return(RedirectToAction("Login", "Employee")); } if (ModelState.IsValid) { db.Entry(city).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.CountryID = new SelectList(db.Countries, "ID", "CountryName", city.CountryID); return(View(city)); }
public ActionResult Edit([Bind(Include = "ID,ProductName,ProductCode,ProductQuentity,ProductDescription,ProductPosition,CategoryID,BrandID")] Product product) { if (Session["type"] == null || Session["type"].ToString() == "") { Session["DefaultView"] = "Edit"; Session["DefaultControll"] = "Product"; return(RedirectToAction("Login", "Employee")); } if (ModelState.IsValid) { db.Entry(product).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.BrandID = new SelectList(db.Brands, "ID", "BrandName", product.BrandID); ViewBag.CategoryID = new SelectList(db.Categories, "ID", "CategoryName", product.CategoryID); return(View(product)); }
public ActionResult Edit(ProductImage productImage, HttpPostedFileBase PI) { if (Session["type"] == null || Session["type"].ToString() == "") { Session["DefaultView"] = "Edit"; Session["DefaultControll"] = "ProductImage"; return(RedirectToAction("Login", "Employee")); } productImage.ProductImage1 = System.IO.Path.GetFileName(PI.FileName); if (ModelState.IsValid) { db.Entry(productImage).State = EntityState.Modified; db.SaveChanges(); PI.SaveAs(Server.MapPath("../Images/ProductImage/UpdateProductImage/" + productImage.ID.ToString() + "_" + productImage.ProductImage1)); return(RedirectToAction("Index")); } ViewBag.ProductID = new SelectList(db.Products, "ID", "ProductName", productImage.ProductID); return(View(productImage)); }
public ActionResult Edit(Employee employee, HttpPostedFileBase EP) { if (Session["type"] == null || Session["type"].ToString() == "") { Session["DefaultView"] = "Edit"; Session["DefaultControll"] = "Employee"; return(RedirectToAction("Login")); } employee.EmployeeJoinDate = DateTime.Now; employee.EmployeePicture = System.IO.Path.GetFileName(EP.FileName); if (ModelState.IsValid) { db.Entry(employee).State = EntityState.Modified; db.SaveChanges(); EP.SaveAs(Server.MapPath("../Images/Uploads/" + employee.ID.ToString() + "_" + employee.EmployeePicture)); return(RedirectToAction("Index")); } ViewBag.EmployeeCityID = new SelectList(db.Cities, "ID", "CityName", employee.EmployeeCityID); ViewBag.ID = new SelectList(db.EmployeeAdmins, "EmployeeID", "EmployeeID", employee.ID); return(View(employee)); }