Exemplo n.º 1
0
 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));
 }
Exemplo n.º 2
0
 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));
 }
Exemplo n.º 3
0
 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));
 }
Exemplo n.º 4
0
 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));
 }
Exemplo n.º 5
0
 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));
 }
Exemplo n.º 6
0
        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;
        }
Exemplo n.º 7
0
        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 }));
        }