예제 #1
0
 public ActionResult Edit(CustomerViewModel customer)
 {
     if (ModelState.IsValid)
     {
         _service.Edit(customer.MapTo <Customer>());
         return(RedirectToAction("Index"));
     }
     return(View(customer));
 }
예제 #2
0
        public IHttpActionResult PostCustomer(CustomerViewModel customer)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            repository.UpdateCustomer(customer.MapTo <Customer>());

            return(Ok(customer));
        }
예제 #3
0
        public IHttpActionResult PutCustomer(CustomerViewModel customer)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            repository.UpdateCustomer(customer.MapTo <Customer>());

            return(StatusCode(HttpStatusCode.NoContent));
        }