public ActionResult ContactoEdit(string editAction, string contactoId) { Dictionary <string, object> parameters = new Dictionary <string, object>(); ContactoDTO contactoDTO = new ContactoDTO(); switch (editAction) { case EditActionConstant.NEW: break; case EditActionConstant.EDIT: contactoDTO = _contactoService.GetById(Convert.ToInt32(contactoId)); break; } List <AreaDTO> areaDTOList = areaService.SearchFor(parameters, string.Empty); ViewBag.AreaList = WebHelper.ToSelectListItem <AreaDTO>( areaDTOList, x => x.AreaId.ToString(), x => x.Nombre, SelectListFirstElementType.Select, string.Empty); List <ContactoDTO> contactoDTOList = _contactoService.SearchFor(parameters, string.Empty); ViewBag.ContactoList = WebHelper.ToSelectListItem <ContactoDTO>( contactoDTOList, x => x.ContactoId.ToString(), x => x.NombreContacto, SelectListFirstElementType.Select, string.Empty); return(PartialView(contactoDTO)); }
public ActionResult Create(string editAction, string contactoId) { ContactoDTO contactoDTO = new ContactoDTO(); switch (editAction) { case EditActionConstant.NEW: ViewBag.Title = "Nuevo Contacto"; contactoDTO.EditAction = editAction; break; case EditActionConstant.EDIT: ViewBag.IsNew = false; ViewBag.Title = "Editar Contacto"; contactoDTO = contactoService.GetById(Convert.ToInt32(contactoId)); contactoDTO.EditAction = editAction; break; } ListarDropList(); return(PartialView(contactoDTO)); }