Exemple #1
0
 public virtual async Task<ActionResult> Edit(Customer customer)
 {
     if (ModelState.IsValid)
     {
         db.Entry(customer).State = EntityState.Modified;
         customer.ModifiedDate = DateTime.Now;
         await db.SaveChangesAsync();
         return RedirectToAction("Index");
     }
     return View(customer);
 }
Exemple #2
0
        public virtual async Task<ActionResult> Create(Customer customer)
        {
            if (ModelState.IsValid)
            {
                db.Customers.Add(customer);
                await db.SaveChangesAsync();
                return RedirectToAction("Index");
            }

            return View(customer);
        }