Esempio n. 1
0
 public bool Eliminar(string id)
 {
     try
     {
         using (unitOfWork = new UnitOfWork(new GymContext()))
         {
             using (GymContext Context = new GymContext())
             {
                 InstructorGym        per = new InstructorGym();
                 List <InstructorGym> p   = Context.InstructorGyms.Select(n => n).Where(l => l.idInstructor == id).ToList();
                 foreach (InstructorGym pe in p)
                 {
                     List <LogUsuario> pp = Context.LogUsuarios.Select(n => n).Where(l => l.usuario == pe.usuario).ToList();
                     Context.InstructorGyms.Remove(pe);
                     Context.SaveChanges();
                     foreach (LogUsuario pee in pp)
                     {
                         Context.LogUsuarios.Remove(pee);
                         Context.SaveChanges();
                     }
                 }
             }
             return(true);
         }
     }
     catch (Exception e)
     {
         string a = e.Message;
         return(false);
     }
 }
Esempio n. 2
0
        public ActionResult GuardarEdicion(string nombreing, string primerapeing, string segundoapeing, string telefonoing, string usuarioing,
                                           string passing, string idInstructor)
        {
            instructorBLL = new InstructorBLLImp();
            usuarioBLL    = new LogUsuarioBLLImp();
            LogUsuario lu = new LogUsuario()
            {
                usuario         = usuarioing,
                pass            = passing,
                idNombreEmpresa = (string)Session["empresa"],
                permiso         = "Instructor"
            };

            InstructorGym ins = new InstructorGym
            {
                idInstructor    = idInstructor,
                nombre          = nombreing,
                apellido1       = primerapeing,
                apellido2       = segundoapeing,
                telefono        = telefonoing,
                idNombreEmpresa = (string)Session["empresa"],
                usuario         = usuarioing
            };

            usuarioBLL.Modificar(lu);
            instructorBLL.Modificar(ins);
            return(Json(new { result = string.Empty }, JsonRequestBehavior.AllowGet));
        }
Esempio n. 3
0
        public ActionResult Ingreso(string nombreing, string primerapeing, string segundoapeing, string telefonoing, string usuarioing,
                                    string passing)
        {
            string idInstructorString;

            instructorBLL = new InstructorBLLImp();
            usuarioBLL    = new LogUsuarioBLLImp();

            idInstructorString = fb.ConsecutivoModifica("INS");

            LogUsuario lu = new LogUsuario()
            {
                usuario         = usuarioing,
                pass            = fb.Encripta(passing),
                idNombreEmpresa = (string)Session["empresa"],
                permiso         = "Instructor"
            };
            InstructorGym ins = new InstructorGym()
            {
                idInstructor    = idInstructorString,
                nombre          = nombreing,
                apellido1       = primerapeing,
                apellido2       = segundoapeing,
                telefono        = telefonoing,
                usuario         = usuarioing,
                idNombreEmpresa = (string)Session["empresa"]
            };

            usuarioBLL.Agregar(lu);
            instructorBLL.Agregar(ins);
            return(Json(new { result = string.Empty }, JsonRequestBehavior.AllowGet));
        }
Esempio n. 4
0
        public ActionResult Editar(string idInstructor)
        {
            instructorBLL = new InstructorBLLImp();
            InstructorGym ins = instructorBLL.BuscarPorId(idInstructor);

            return(Json(new
            {
                nombre = ins.nombre,
                apellido1 = ins.apellido1,
                apellido2 = ins.apellido2,
                telefono = ins.telefono,
                usuario = ins.usuario,
                idIns = ins.idInstructor
            }, JsonRequestBehavior.AllowGet));
        }
Esempio n. 5
0
 public bool Modificar(InstructorGym instructor)
 {
     try
     {
         using (unitOfWork = new UnitOfWork(new GymContext()))
         {
             unitOfWork.instructorDAL.Update(instructor);
             unitOfWork.Complete();
         }
         return(true);
     }
     catch (Exception e)
     {
         string a = e.Message;
         return(false);
     }
 }
Esempio n. 6
0
        public bool Agregar(InstructorGym instructor)
        {
            try
            {
                using (unitOfWork = new UnitOfWork(new GymContext()))
                {
                    unitOfWork.instructorDAL.Add(instructor);
                    unitOfWork.Complete();
                }

                return(true);
            }
            catch (Exception)
            {
                return(false);
            }
        }
Esempio n. 7
0
        public ActionResult GuardarEdicion2(string nombreing, string primerapeing, string segundoapeing, string telefonoing, string idInstructor)
        {
            instructorBLL = new InstructorBLLImp();
            usuarioBLL    = new LogUsuarioBLLImp();
            InstructorGym InsViejo = instructorBLL.BuscarPorId(idInstructor);
            InstructorGym ins      = new InstructorGym
            {
                idInstructor    = idInstructor,
                nombre          = nombreing,
                apellido1       = primerapeing,
                apellido2       = segundoapeing,
                telefono        = telefonoing,
                usuario         = InsViejo.usuario,
                idNombreEmpresa = (string)Session["empresa"]
            };

            instructorBLL.Modificar(ins);
            return(Json(new { result = string.Empty }, JsonRequestBehavior.AllowGet));
        }