public async Task <IActionResult> ResolverQueja(List <ClsInfoInformQuejas> model) { ClsPeticiones peticiones = new ClsPeticiones(); AdminSession sesion = new AdminSession(HttpContext); bool ok = true; foreach (var item in model) { if (item.check && string.IsNullOrEmpty(item.DescripcioResuelve)) { ok = false; } } if (ok) { var response = await peticiones.PostComplejoAutenticado <List <ClsInfoInformQuejas>, Cls_Response <string> >(model, "Quejas/AtenderQuejas", sesion.GetClaim(VariablesDeSession.Token)); if (!response.Error) { sesion.SetString(response.Body, VariablesDeSession.MensajeExito); return(RedirectToAction("AtenderQueja", "Quejas")); } else { return(View("AtenderQueja", model)); } } else { return(View("AtenderQueja", model)); } }
public async Task <IActionResult> GuardarEstablecimiento(ClsCreateEstablecimiento model) { ClsPeticiones peticiones = new ClsPeticiones(); ClsCatalogos catalogos = new ClsCatalogos(); List <int> ids = new List <int> { 1, 2 }; ViewBag.ListEstados = new SelectList(await catalogos.ListEstados(ids), "IdEstado", "NombreEstado"); ViewBag.ListaDepartamentos = new SelectList(await catalogos.ListDepartamentos(), "IdDepartamento", "NombreDepartamento"); AdminSession session = new AdminSession(HttpContext); if (ModelState.IsValid) { model.Establecimiento.IdEmpresa = int.Parse(session.GetString(VariablesDeSession.IdEmpresa)); var response = await peticiones.PostComplejoAutenticado <TbEstablecimiento, Cls_Response <string> >(model.Establecimiento, "Comercios/GuardarEstablecimiento", session.GetClaim(VariablesDeSession.Token)); if (!response.Error) { session.SetString(response.Body, VariablesDeSession.MensajeExito); return(RedirectToAction("AdminEstablecimientos", "Comercios", new { IdEmpresa = session.GetString(VariablesDeSession.IdEmpresa) })); } else { ViewBag.Error = response.Message; return(View("AdminEstablecimientos", model)); } } else { return(View("AdminEstablecimientos", model)); } }
public async Task <IActionResult> AdminEstablecimientos(string IdEmpresa) { ClsPeticiones peticiones = new ClsPeticiones(); ClsCatalogos catalogos = new ClsCatalogos(); AdminSession sesion = new AdminSession(HttpContext); List <int> ids = new List <int> { 1, 2 }; ViewBag.ListEstados = new SelectList(await catalogos.ListEstados(ids), "IdEstado", "NombreEstado"); ViewBag.ListaDepartamentos = new SelectList(await catalogos.ListDepartamentos(), "IdDepartamento", "NombreDepartamento"); sesion.SetString(IdEmpresa, VariablesDeSession.IdEmpresa); //var result = await peticiones.GetComplejoAnonimo<string, Cls_Response<List<ClsInfoSucursales>>>("Comercios/GetEstablecimientosById/" + IdEmpresa); ClsCreateEstablecimiento model = new ClsCreateEstablecimiento(); model.Establecimiento = new TbEstablecimiento(); if (sesion.GetString(VariablesDeSession.MensajeExito) != null) { ViewBag.Exito = sesion.GetString(VariablesDeSession.MensajeExito); sesion.Remove(VariablesDeSession.MensajeExito); } return(View(model)); }
public async Task <IActionResult> GuardarQueja(ClsRegistroQueja model) { ClsCatalogos catalogos = new ClsCatalogos(); ViewBag.ListaDepartamentos = new SelectList(await catalogos.ListDepartamentos(), "IdDepartamento", "NombreDepartamento"); ViewBag.LisCatQueja = new SelectList(await catalogos.ListCategoriaQueja(), "IdCategoriaQueja", "Nombre"); ViewBag.Categoria = new SelectList(await catalogos.ListCategoriaQueja(), "IdCategoriaQueja", "Nombre"); if (ModelState.IsValid) { TbQueja queja = new TbQueja { Descripcion = model.DescripcionQueja, IdEstado = 3, IdEstablecimiento = model.IdComercio, IdCategoriaQueja = 1 }; ClsPeticiones peticiones = new ClsPeticiones(); var response = await peticiones.PostComplejo <TbQueja, Cls_Response <string> >(queja, "Quejas/GuardarQueja"); if (!response.Error) { AdminSession session = new AdminSession(HttpContext); session.SetString(response.Body, VariablesDeSession.MensajeExito); session.SetString(response.Body, VariablesDeSession.MensajeExito); return(RedirectToAction("Registrar", "Quejas")); } else { ViewBag.Error = response.Message; return(View("Registrar", model)); } } else { return(View("Registrar", model)); } }
public async Task <IActionResult> GuardarEmpresa(ClsCreateEmpresa model) { ClsCatalogos catalogos = new ClsCatalogos(); List <int> ids = new List <int> { 1, 2 }; ViewBag.ListEstados = new SelectList(await catalogos.ListEstados(ids), "IdEstado", "NombreEstado"); if (ModelState.IsValid) { ClsPeticiones peticiones = new ClsPeticiones(); AdminSession sesion = new AdminSession(HttpContext); var response = await peticiones.PostComplejoAutenticado <TbEmpresa, Cls_Response <string> >(model.Empresa, "Comercios/GuardarEmpresa", sesion.GetClaim(VariablesDeSession.Token)); if (response != null) { if (!response.Error) { sesion.SetString(response.Body, VariablesDeSession.MensajeExito); return(RedirectToAction("RegistrarComercios", "Comercios")); } else { ViewBag.Error = response.Message; return(View("RegistrarComercios", model)); } } else { ViewBag.Error = "Error al comunicarse con el servicio."; return(View("RegistrarComercios", model)); } } else { return(View("RegistrarComercios", model)); } }