public ActionResult Edit([Bind(Include = "Id,Date,IsOpen,Description")] Incident incident) { if (ModelState.IsValid) { db.Entry(incident).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(incident)); }
public ActionResult Edit([Bind(Include = "Id,Name")] Category category) { if (ModelState.IsValid) { db.Entry(category).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(category)); }
public ActionResult Edit([Bind(Include = "Id,FirstName,LastName,PhoneNumber,AddressStreet,AddressCity,AddressZip,AddressState,Email")] Customer customer) { if (ModelState.IsValid) { db.Entry(customer).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Details", new { id = customer.Id })); } return(View(customer)); }
public ActionResult Edit([Bind(Include = "Id,UnitPrice,ItemPrice")] SaleItem saleItem) { if (ModelState.IsValid) { db.Entry(saleItem).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(saleItem)); }
public ActionResult Edit([Bind(Include = "Id,Name,TaxRate")] Company company) { if (ModelState.IsValid) { db.Entry(company).State = EntityState.Modified; db.SaveChanges(); CompanyNameActionAttribute.FlushCachedCompanyName(); return(RedirectToAction("Index", "Home")); } return(View(company)); }
private async void ReFocusRow(bool withReload = true) { int id = EditVM.TheEntity.BankAccountID; SelectedBankAccount = null; await db.Entry(EditVM.TheEntity).ReloadAsync(); await Application.Current.Dispatcher.InvokeAsync(new Action(() => { SelectedBankAccount = BankAccounts.Where(e => e.TheEntity.BankAccountID == id).FirstOrDefault(); SelectedBankAccount.TheEntity = SelectedBankAccount.TheEntity; SelectedBankAccount.TheEntity.ClearErrors(); }), DispatcherPriority.ContextIdle); IsInEditMode = false; }
public ActionResult Close(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Service service = db.Services.Find(id); if (service == null) { return(HttpNotFound()); } service.IsOpen = false; service.Customer = service.Customer; service.Employee = service.Employee; service.Product = service.Product; db.Entry(service).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Details", new { id = service.Id })); }