// PUT: api/HomeApi/5 public void Put(int id, Customer customer) { customer.Id = id; this.customerRepository.Update(customer); this.customerRepository.Save(); }
public ActionResult Edit(Customer customer) { try { if (ModelState.IsValid) { customerRepository.Update(customer); customerRepository.Save(); return RedirectToAction("Index"); } } catch { ModelState.AddModelError(string.Empty, "Could not save customer"); } return View(customer); }
public ActionResult EditTemplate() { var model = new Customer(); return PartialView("~/Views/Partials/_EditCustomer.cshtml", model); }
// POST: api/HomeApi public void Post(Customer customer) { this.customerRepository.Create(customer); this.customerRepository.Save(); }
public void Update(Customer entity) { this._dbContext.Entry(entity).State = EntityState.Modified; }
public void Create(Customer entity) { this._dbContext.Customers.Add(entity); }