public IHttpActionResult PutCategory(int id, Category category) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != category.CategoryID) { return(BadRequest()); } db.Entry(category).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!CategoryExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public ActionResult Edit([Bind(Include = "DocumentTypeID,Description")] DocumentType documenttype) { if (ModelState.IsValid) { db.Entry(documenttype).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(documenttype)); }
public ActionResult Edit([Bind(Include = "ProductID,Description,Price,LastBuy,Stock,Remarks")] Product product) { if (ModelState.IsValid) { db.Entry(product).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(product)); }
public ActionResult Edit([Bind(Include = "CategoryID,Description")] Category category) { if (ModelState.IsValid) { db.Entry(category).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(category)); }
public ActionResult Edit([Bind(Include = "SupplierID,Name,ContactFirstName,ContactLastName,Phone,Address,Email")] Supplier supplier) { if (ModelState.IsValid) { db.Entry(supplier).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(supplier)); }
public ActionResult Edit([Bind(Include = "CustomerID,Name,LastName,Phone,Address,Email,Document,DocumentTypeID")] Customer customer) { if (ModelState.IsValid) { db.Entry(customer).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.DocumentTypeID = new SelectList(db.DocumentTypes, "DocumentTypeID", "Description", customer.DocumentTypeID); return(View(customer)); }
public ActionResult Edit([Bind(Include = "EmployeeID,FirstName,LastName,Salary,BonusPercent,DateOfBirth,StartTime,Email,URL,DocumentTypeID")] Employee employee) { if (ModelState.IsValid) { db.Entry(employee).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.DocumentTypeID = new SelectList(db.DocumentTypes, "DocumentTypeID", "Description", employee.DocumentTypeID); return(View(employee)); }