public ActionResult Edit(AgendaViewModel agenda) { if (ModelState.IsValid) { servicoAgenda.Atualizar(Mapper.Map <AgendaViewModel, Agenda>(agenda)); return(RedirectToAction("Index")); } return(View(agenda)); }
public HttpResponseMessage Put(AgendaEdicaoViewModel entity) { if (ModelState.IsValid) { try { appService.Atualizar(entity); return(Request.CreateResponse(HttpStatusCode.OK)); } catch (Exception ex) { return(Request.CreateResponse(HttpStatusCode.BadRequest, ex.Message)); } } else { return(Request.CreateResponse(HttpStatusCode.Forbidden, Util.ValidationUtil(ModelState))); } }