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 ListarBandeja(string nombre, string numDocumento) { Dictionary <string, object> parameters = new Dictionary <string, object>(); try { if (!string.IsNullOrEmpty(nombre)) { parameters.Add("nombre", nombre); } if (!string.IsNullOrEmpty(numDocumento)) { parameters.Add("numDocumento", numDocumento); } List <ContactoDTO> contactoDTOList = contactoService.SearchFor(parameters, string.Empty).Cast <ContactoDTO>().ToList(); int index = 1; var jsonData = new { total = 1, page = 1, records = contactoDTOList.Count, rows = from f in contactoDTOList.AsEnumerable() select new { id = index++, cell = new { f.ContactoId, f.NombreContacto, f.NumeroDocumentoContacto, f.TelefonoContacto, f.CelularContacto, f.EmailContacto, f.DireccionContacto } } }; return(Json(jsonData)); } catch (Exception ex) { throw ex; } }