Пример #1
0
 public IActionResult Post([FromBody] CustomerAppBll.BusinessObjects.CustomerBO customerBO)
 {
     if (!ModelState.IsValid)
     {
         return(BadRequest(ModelState));
     }
     try
     {
         return(Ok(facade.CustomerService.Create(customerBO)));
     }
     catch
     {
         return(BadRequest("Could Not Create a Customer "));
     }
 }
Пример #2
0
 public IActionResult Put(int id, [FromBody] CustomerAppBll.BusinessObjects.CustomerBO cust)
 {
     if (id != cust.Id)
     {
         return(BadRequest("The Id in the Url is different of the id in the object"));
     }
     try
     {
         return(Ok(facade.CustomerService.Update(cust)));
     }
     catch (InvalidOperationException e)
     {
         return(StatusCode((int)HttpStatusCode.NotAcceptable, e.Message));
         //return BadRequest("Could not update a customer");
     }
 }