コード例 #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));
        }