public ActionResult Edit(CustomerViewModel customer) { if (ModelState.IsValid) { _service.Edit(customer.MapTo <Customer>()); return(RedirectToAction("Index")); } return(View(customer)); }
public IHttpActionResult PostCustomer(CustomerViewModel customer) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } repository.UpdateCustomer(customer.MapTo <Customer>()); return(Ok(customer)); }
public IHttpActionResult PutCustomer(CustomerViewModel customer) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } repository.UpdateCustomer(customer.MapTo <Customer>()); return(StatusCode(HttpStatusCode.NoContent)); }