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

            return(View(contactInfoDetailDto));
        }