public JsonResult CheckCubiculo(int SucId, string Cubiculo)
        {
            Cubiculo           obj    = new Cubiculo();
            CubiculoRepository SucRep = new CubiculoRepository();

            try
            {
                if (SucId != -1 || Cubiculo != string.Empty)
                {
                    obj.Accion = SucRep.CheckCubiculo(SucId, Cubiculo);
                    if (obj.Accion == -1)
                    {
                        obj.Mensaje = "Se genero un error al verificar la existencia del cubiculo!";
                    }
                }
                else
                {
                    obj.Accion  = -1;
                    obj.Mensaje = "El parametro tiene un valor incorrecto!";
                }
            }
            catch (Exception ex)
            {
                //throw;
                obj.Accion  = -1;
                obj.Mensaje = ex.Message.ToString();
                //return Json(list, JsonRequestBehavior.AllowGet);
            }

            return(Json(obj, JsonRequestBehavior.AllowGet));
        }
        public JsonResult SaveDataCubiculos(Cubiculo cubiculo)
        {
            try
            {
                CubiculoRepository SucCub = new CubiculoRepository();
                if (ModelState.IsValid)
                {
                    SucCub.Save(cubiculo);
                    //db.Sucursal.Add(sucursal);
                    //db.SaveChanges();
                }
                else
                {
                    cubiculo.Accion  = 0;
                    cubiculo.Mensaje = "Los datos enviados no son correctos, intente de nuevo!";
                }
                //return Json(horarios, JsonRequestBehavior.AllowGet);
            }
            catch (Exception ex)
            {
                //throw;
                cubiculo.Accion  = 0;
                cubiculo.Mensaje = ex.Message.ToString();
            }

            return(Json(cubiculo, JsonRequestBehavior.AllowGet));
        }
        public JsonResult GetCubiculosByCita(int sucursalid)
        {
            CubiculoRepository SucCub = new CubiculoRepository();

            try
            {
                return(Json(SucCub.GetCubiculosByCita(sucursalid), JsonRequestBehavior.AllowGet));
            }
            catch (Exception ex)
            {
                List <Cubiculo> list = new List <Cubiculo>();
                Cubiculo        obj  = new Cubiculo();
                obj.Accion  = 0;
                obj.Mensaje = ex.Message.ToString();
                list.Add(obj);
                return(Json(list, JsonRequestBehavior.AllowGet));
            }
        }
        public JsonResult GetCubiculoById(int id, string cub)
        {
            CubiculoRepository SucCub = new CubiculoRepository();

            try
            {
                return(Json(SucCub.GetCubiculo(id, cub), JsonRequestBehavior.AllowGet));
            }
            catch (Exception ex)
            {
                //throw;
                List <Cubiculo> list = new List <Cubiculo>();
                Cubiculo        obj  = new Cubiculo();
                obj.Accion  = 0;
                obj.Mensaje = ex.Message.ToString();
                list.Add(obj);
                return(Json(list, JsonRequestBehavior.AllowGet));
            }
        }
        public JsonResult deleteCubiculo(int SucursalId, string CubId)
        {
            Cubiculo           obj   = new Cubiculo();
            CubiculoRepository SSRep = new CubiculoRepository();

            try
            {
                if (CubId != "")
                {
                    obj = SSRep.Del(SucursalId, CubId);
                }
                else
                {
                    obj.Accion  = 0;
                    obj.Mensaje = "El parametro tiene un valor incorrecto!";
                }
            }
            catch (Exception ex)
            {
                obj.Accion  = 0;
                obj.Mensaje = ex.Message.ToString();
            }
            return(Json(obj, JsonRequestBehavior.AllowGet));
        }