public ActionResult ModelarTablero(int id, string callBack = "SetModelarTablero") { try { _estructuraAreaLogica = new EstructuraAreaLogica(); _estructuraInstanciaLogica = new EstructuraInstanciaLogica(); Estructura model = new Estructura { Id = id }; model.Areas = _estructuraAreaLogica.Listar(id) ?? new List <EstructuraArea>(); model.Instancias = _estructuraInstanciaLogica.Listar(id) ?? new List <EstructuraInstancia>(); _instanciaLogica = new InstanciaLogica(); ViewBag.Instancias = _instanciaLogica.Listar() ?? new List <Instancia>(); _areaLogica = new AreaLogica(); ViewBag.Areas = _areaLogica.Listar() ?? new List <Area>(); ViewBag.CallBack = callBack; return(PartialView("_ModelarTablero", model)); } catch (Exception ex) { Response.StatusCode = (int)HttpStatusCode.BadRequest; ViewBag.Message = ex.Message; return(PartialView("_Error")); } }
public ActionResult Editar(int id, string callBack = "SetInstancia") { try { _colorLogica = new ColorLogica(); ViewBag.Colores = _colorLogica.Listar() ?? new List <Color>(); ViewBag.CallBack = callBack; _instanciaLogica = new InstanciaLogica(); Instancia model = _instanciaLogica.Buscar(id); return(PartialView("_Editar", model)); } catch (Exception ex) { Response.StatusCode = (int)HttpStatusCode.BadRequest; ViewBag.Message = ex.Message; return(PartialView("_Error")); } }
public ActionResult Listar() { try { _instanciaLogica = new InstanciaLogica(); List <Instancia> lista = _instanciaLogica.Listar() ?? new List <Instancia>(); string respuesta = JsonConvert.SerializeObject(lista.Select(x => new { x.Id, x.Abreviatura, x.Descripcion })); return(Content(respuesta, "application/json")); } catch (Exception ex) { Response.StatusCode = (int)HttpStatusCode.BadRequest; ViewBag.Message = ex.Message; return(PartialView("_Error")); } }
public ActionResult Editar(Instancia model) { try { Validar(model); if (ModelState.IsValid) { _instanciaLogica = new InstanciaLogica(); _instanciaLogica.Actualizar(model); return(Content(model.Id.ToString())); } else { Response.StatusCode = (int)HttpStatusCode.BadRequest; return(PartialView("_Error")); } } catch (Exception ex) { Response.StatusCode = (int)HttpStatusCode.BadRequest; ViewBag.Message = ex.Message; return(PartialView("_Error")); } }