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

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

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

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

            return(StatusCode(HttpStatusCode.NoContent));
        }