Exemplo n.º 1
0
        public ActionResult EditDias(int id)
        {
            var    diasBLL = new DiaBLL();
            tblDia objdia  = diasBLL.RetrieveDiaByID(id);

            return(View(objdia));
        }
Exemplo n.º 2
0
        //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);
        }
Exemplo n.º 3
0
        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));
        }
Exemplo n.º 4
0
        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);
        }
Exemplo n.º 5
0
        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);
        }
Exemplo n.º 6
0
        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);
        }
Exemplo n.º 7
0
        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);
        }