public ActionResult EditDias(int id) { var diasBLL = new DiaBLL(); tblDia objdia = diasBLL.RetrieveDiaByID(id); return(View(objdia)); }
//public tblAnio RetrieveByAnioTexto(int anio) //{ // tblAnio Result = null; // using (var r = new Repository<tblAnio>()) // { // Result = r.Retrieve(p => p.anio == anio); // } // return Result; //} public tblDia RetrieveDiaByID(int id) { tblDia Result = null; using (var r = new Repository <tblDia>()) { Result = r.Retrieve(p => p.idDias == id); } return(Result); }
public JsonResult DeleteDias(int id) { var diasBLL = new DiaBLL(); wmJsonResult objJson = new wmJsonResult(); try { tblDia dia = diasBLL.RetrieveDiaByID(id); if (dia != null) { var citaBLL = new CitaBLL(); List <tblCita> listaCitas = citaBLL.RetrieveCitaDiaByID(id); if (listaCitas.Count() >= 0) { //Tiene Citas } bool banderita = diasBLL.Delete(id); if (banderita == true) { objJson.bandera = true; objJson.mensaje = "El dia se eliminó correctamente"; } else { objJson.bandera = false; objJson.mensaje = "El dia NO se eliminó correctamente"; } } else { objJson.bandera = false; objJson.mensaje = "El dia no se encontró"; } } catch { objJson.bandera = false; objJson.mensaje = "Ocurrio una excepcion al eliminar el dia"; } return(Json(objJson, JsonRequestBehavior.AllowGet)); }
public bool Delete(int id) { bool Result = false; tblDia obj = RetrieveDiaByID(id); if (obj != null) { using (var r = new Repository <tblDia>()) { Result = r.Delete(obj); } } else { throw (new Exception("El dia seleccionada no se pudo eliminar.")); } return(Result); }
public bool Update(tblDia t) { bool Result = false; using (var r = new Repository <tblDia>()) { tblDia ba = r.Retrieve(p => p.idDias == t.idDias && p.dia == t.dia); if (ba == null) { Result = r.Update(t); } else { throw (new Exception("No se pudo actualizar el dia seleccionado.")); } } return(Result); }
public tblDia Create(tblDia t) { tblDia Result = null; using (var r = new Repository <tblDia>()) { tblDia ba = r.Retrieve(p => p.idDias == t.idDias && p.dia == t.dia); if (ba == null) { Result = r.Create(t); } else { throw (new Exception("El dia ya existe.")); } } return(Result); }
public ActionResult EditDias(tblDia dia) { var diasBLL = new DiaBLL(); ActionResult Result = null; try { if (ModelState.IsValid) { diasBLL.Update(dia); Result = RedirectToAction("IndexDias"); } } catch { return(View()); } return(Result); }