Exemplo n.º 1
0
 public HttpResponseMessage Update(ContactDetailDto contact)
 {
     try
     {
         _contactCrudService.UpdateContact(contact);
         return(Request.CreateResponse(HttpStatusCode.OK, contact));
     }
     catch (ValidationException ex)
     {
         return(Request.CreateErrorResponse(HttpStatusCode.BadRequest, ex.Message));
     }
 }
Exemplo n.º 2
0
        public ActionResult Edit(ContactDetailDto contact)
        {
            if (ModelState.IsValid)
            {
                try
                {
                    _contactCrudService.UpdateContact(contact);
                    return(RedirectToAction("Index"));
                }
                catch (ValidationException ex)
                {
                    ModelState.AddValidationErrors(ex);
                }
            }

            contact.ContactInfos = _contactCrudService.GetContactInfosForContact(contact.Id).ToList();
            return(View(contact));
        }