public HttpResponseMessage Create(ContactInfoDetailDto contact) { try { _contactCrudService.CreateContactInfo(contact); return(Request.CreateResponse(HttpStatusCode.Created, contact)); } catch (ValidationException ex) { return(Request.CreateErrorResponse(HttpStatusCode.BadRequest, ex.Message)); } }
public ActionResult Create(ContactInfoDetailDto contactInfoDetailDto) { if (ModelState.IsValid) { try { _contactCrudService.CreateContactInfo(contactInfoDetailDto); return(RedirectToAction("Edit", "Contacts", new { id = contactInfoDetailDto.ContactId })); } catch (ValidationException ex) { ModelState.AddValidationErrors(ex); } } return(View(contactInfoDetailDto)); }