public ActionResult Save(SalasEntity entity) { try { var result = new DBEntity(); if (entity.IdSalas.HasValue) { result = IApp.salasService.Actualizar(entity); TempData["msg"] = "Se Actualizo el registro con exito!"; } else { result = IApp.salasService.Insertar(entity); TempData["msg"] = "Se agrego el registro con exito!"; } if (result.CodeError != 0) { throw new Exception(result.MsgError); } return(RedirectToAction("Index")); } catch (Exception ex) { return(Content(ex.Message)); } }
public ActionResult Edit(int?id) { this.SessionOnline(); var entity = new SalasEntity(); try { ViewBag.Form = false; if (id.HasValue) { //editar ViewBag.Form = true; entity = IApp.salasService.ObtenerLista(id).FirstOrDefault(); } } catch (Exception ex) { return(Content(ex.Message)); } return(View(entity)); }
public DBEntity Eliminar(SalasEntity entity) { try { var result = sql.QueryExecute("SalasEliminar", new { entity.IdSalas }); return(result); } catch (Exception ex) { return(new DBEntity { CodeError = ex.HResult, MsgError = ex.Message }); } }
public DBEntity Insertar(SalasEntity entity) { try { var result = sql.QueryExecute("SalasInsertar", new { entity.NombreSalas, entity.CantidadSalas, entity.EstadoSalas }); return(result); } catch (Exception ex) { return(new DBEntity { CodeError = ex.HResult, MsgError = ex.Message }); } }