Esempio n. 1
0
        public ActionResult Edit(TablaViewModel model)
        {
            WebService1SoapClient client = new WebService1SoapClient();

            try

            {
                if (ModelState.IsValid)
                {
                    var schedule = client.GetSchedule(model.ID_Schedule);
                    schedule.ID_Schedule = model.ID_Schedule;
                    schedule.Day         = model.Day;
                    schedule.State       = model.State;


                    client.UpdateSchedule(model.ID_Schedule, model.Day, model.State);


                    return(Redirect("~/Schedule/"));
                }

                return(View(model));
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
        }
Esempio n. 2
0
        public ActionResult Edit(TablaViewModel model)
        {
            WebService1SoapClient client = new WebService1SoapClient();

            try

            {
                if (ModelState.IsValid)
                {
                    var person = client.GetPerson(model.ID_Person);
                    person.Identification = model.Identification;
                    person.Name           = model.Name;
                    person.Mail           = model.Mail;
                    person.Password       = model.Password;
                    person.Ind_User       = model.Ind_User;
                    person.Points         = model.Points;

                    client.UpdatePerson(model.ID_Person, model.Identification, model.Name, model.Mail, model.Password, model.Points, model.Ind_User);


                    return(Redirect("~/Person/"));
                }

                return(View(model));
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
        }
Esempio n. 3
0
        public ActionResult Editar(TablaViewModel model)
        {
            try
            {
                if (ModelState.IsValid)
                {
                    using (CrudEntities db = new CrudEntities())
                    {
                        var oTabla = db.Tabla.Find(model.Id);
                        oTabla.correo = model.Correo;
                        oTabla.fecha_nacimiento = model.fecha_Nacimiento;
                        oTabla.nombre = model.Nombre;

                        db.Entry(oTabla).State = System.Data.Entity.EntityState.Modified;
                        db.SaveChanges();
                    }

                    return Redirect("~/Tabla/");
                }

                return View(model);


            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
        }
Esempio n. 4
0
        public ActionResult Edit(TablaViewModel model)
        {
            try
            {
                if (ModelState.IsValid)
                {
                    using (DBContextCF db = new DBContextCF())
                    {
                        var schedule = db.Schedules.Find(model.ID_Schedule);
                        schedule.ID_Schedule = model.ID_Schedule;
                        schedule.Day         = model.Day;
                        schedule.State       = model.State;

                        db.Entry(schedule).State = System.Data.Entity.EntityState.Modified;
                        db.SaveChanges();
                    }

                    return(Redirect("~/Schedule/"));
                }
                return(View(model));
            }
            catch (Exception ex)
            {
                Console.WriteLine("ServicesMVC_Direct.ScheduleController.ActionResult_Edit(TablaViewModel model)" + ex.Message);
                return(null); //de otra forma retorne nulo
            }
        }
Esempio n. 5
0
        public ActionResult Nuevo(TablaViewModel model)
        {
            try
            {
                if (ModelState.IsValid)
                {
                    using (CrudEntities db = new CrudEntities())
                    {
                        var oTabla = new Tabla();
                        oTabla.correo = model.Correo;
                        oTabla.fecha_nacimiento = model.fecha_Nacimiento;
                        oTabla.nombre = model.Nombre;

                        db.Tabla.Add(oTabla);
                        db.SaveChanges();
                    }

                    return Redirect("/");
                }

                return View(model);


            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
        }
Esempio n. 6
0
        public ActionResult Nuevo()
        {
            TablaViewModel lsta = new TablaViewModel();

            using (CrudEntities db = new CrudEntities())
            {
                var lst1 = db.Tickets.SqlQuery("Select top 1 t.* from Tickets t where t.tipo = 1 order by t.id DESC ").ToList();
                var lst2 = db.Tickets.SqlQuery("Select top 1 t.* from Tickets t where t.tipo = 2 order by t.id DESC ").ToList();

                DateTime ahora = System.DateTime.Now;

                if (lst1.Count != 0)
                {
                    DateTime fechaF1 = lst1.First().tiempo;
                    lsta.TiempoF1    = CalcularTiempo(Convert.ToInt32((fechaF1 - ahora).TotalSeconds));
                    lsta.TiempoBase1 = lst1.First().tiempo;
                }



                if (lst2.Count != 0)
                {
                    DateTime fechaF2 = lst2.First().tiempo;
                    lsta.TiempoF2    = CalcularTiempo(Convert.ToInt32((fechaF2 - ahora).TotalSeconds));
                    lsta.TiempoBase2 = lst2.First().tiempo;
                }
            }

            return(View(lsta));
        }
Esempio n. 7
0
        public ActionResult New(TablaViewModel model)
        {
            try
            {
                if (ModelState.IsValid)
                {
                    using (DBContextCF db = new DBContextCF())
                    {
                        var batch = new Batch();
                        batch.ID_Movie    = model.ID_Movie;
                        batch.ID_Room     = model.ID_Room;
                        batch.ID_Schedule = model.ID_Schedule;
                        batch.ID_Movie    = model.ID_Movie;


                        db.Batches.Add(batch);
                        db.SaveChanges();
                    }
                    return(Redirect("~/Batch/"));
                }

                return(View(model));
            }
            catch (Exception ex)
            {
                Console.WriteLine("ServicesMVC_Direct.BatchController.ActionResult New(TablaViewModel model)" + ex.Message);
                return(null); //de otra forma retorne nulo
            }
        }
Esempio n. 8
0
        public ActionResult Nuevo(TablaViewModel model)
        {
            try
            {
                if (ModelState.IsValid)
                {
                    using (CrudEntities db = new CrudEntities())
                    {
                        var oTabla = new Tickets();
                        if (model.Tipo == 1)
                        {
                            if (model.TiempoBase1 < DateTime.Now)
                            {
                                model.Tiempo = DateTime.Now.AddMinutes(2);
                            }
                            else
                            {
                                model.Tiempo = model.TiempoBase1.AddMinutes(2);
                            }
                        }
                        else
                        {
                            if (model.TiempoBase2 < DateTime.Now)
                            {
                                model.Tiempo = DateTime.Now.AddMinutes(3);
                            }
                            else
                            {
                                model.Tiempo = model.TiempoBase2.AddMinutes(3);
                            }
                        }

                        oTabla.nombrePersona = model.NombrePersona;
                        oTabla.tiempo        = model.Tiempo;

                        oTabla.idPersona = model.DniPersona;
                        oTabla.tipo      = model.Tipo;


                        db.Tickets.Add(oTabla);

                        db.SaveChanges();
                    }

                    return(Redirect("/"));
                }


                return(View(model));
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
        }
Esempio n. 9
0
        public ActionResult Eliminar(int Id)
        {
            TablaViewModel model = new TablaViewModel();

            using (CrudEntities db = new CrudEntities())
            {
                var oTabla = db.tabla.Find(Id);
                db.tabla.Remove(oTabla);
                db.SaveChanges();
            }
            return(Redirect("~/Tabla/"));
        }
Esempio n. 10
0
        public ActionResult Eliminar(int id)
        {
            TablaViewModel model = new TablaViewModel();

            using (masterEntities1 db = new masterEntities1())
            {
                var oTabla = db.Tabla.Find(id);
                db.Tabla.Remove(oTabla);
                db.SaveChanges();
            }
            return(Redirect("/Tabla"));
        }
Esempio n. 11
0
        public ActionResult Editar(int id)
        {
            TablaViewModel model = new TablaViewModel();

            using (masterEntities1 db = new masterEntities1()) {
                var oTabla = db.Tabla.Find(id);
                model.Nombre = oTabla.nombre;
                model.Correo = oTabla.correo;
                model.Fecha  = oTabla.fecha;
                model.Id     = oTabla.id;
            }
            return(View(model));
        }
Esempio n. 12
0
 public ActionResult Editar(int Id)
 {
     TablaViewModel model = new TablaViewModel();
     using (CrudEntities db = new CrudEntities())
     {
         var oTabla = db.Tabla.Find(Id);
         model.Nombre = oTabla.nombre;
         model.Correo = oTabla.correo;
         model.fecha_Nacimiento = oTabla.fecha_nacimiento;
         model.Id = oTabla.id;
     }
     return View(model);
 }
Esempio n. 13
0
        public ActionResult Edit(int id)
        {
            TablaViewModel        model  = new TablaViewModel();
            WebService1SoapClient client = new WebService1SoapClient();

            var purchase = client.GetPurchase(id);

            model.ID_Batch      = model.ID_Batch;
            model.ID_Person     = model.ID_Person;
            model.Date_Purchase = model.Date_Purchase;
            model.ID_Purchase   = purchase.ID_Purchase;

            return(View(model));
        }
Esempio n. 14
0
        public ActionResult Edit(int id)
        {
            TablaViewModel        model  = new TablaViewModel();
            WebService1SoapClient client = new WebService1SoapClient();

            var schedule = client.GetSchedule(id);

            model.Day         = model.Day;
            model.State       = model.State;
            model.ID_Schedule = schedule.ID_Schedule;


            return(View(model));
        }
Esempio n. 15
0
        public ActionResult Editar(int Id)
        {
            TablaViewModel model = new TablaViewModel();

            using (pruebaEntities1 db = new pruebaEntities1())
            {
                var registro = db.tabla.Find(Id);
                model.Correo           = registro.correo;
                model.Nombre           = registro.nombre;
                model.Fecha_Nacimiento = registro.fecha_nacimiento;
                model.Id = registro.id;
            }
            return(View(model));
        }
Esempio n. 16
0
        public ActionResult Editar(int Id)
        {
            TablaViewModel model = new TablaViewModel();

            using (DataProductsEntities db = new DataProductsEntities())
            {
                var oTabla = db.Products.Find(Id);
                model.Nombre       = oTabla.Nombre;
                model.Title        = oTabla.Title;
                model.Description  = oTabla.Description;
                model.Observations = oTabla.Observations;
                model.PriceClient  = oTabla.PriceClient;
            }
            return(View(model));
        }
Esempio n. 17
0
        public ActionResult New(TablaViewModel model)
        {
            WebService1SoapClient client = new WebService1SoapClient();

            var schedule = new Schedule();

            schedule.ID_Schedule = model.ID_Schedule;
            schedule.Day         = model.Day;
            schedule.State       = model.State;

            client.AddSchedule(model.Day, model.State);


            return(Redirect("~/Schedule/"));
        }
Esempio n. 18
0
        public ActionResult Edit(int id)
        {
            TablaViewModel        model  = new TablaViewModel();
            WebService1SoapClient client = new WebService1SoapClient();

            var room = client.GetRoom(id);

            model.Capacity    = model.Capacity;
            model.Description = model.Description;
            model.State       = model.State;
            model.ID_Room     = room.ID_Room;


            return(View(model));
        }
Esempio n. 19
0
        public ActionResult Editar(int Id)
        {
            TablaViewModel model = new TablaViewModel();

            using (AlumnoEntities db = new AlumnoEntities())
            {
                var oTabla = db.Tabla.Find(Id);
                model.NombreAlumno       = oTabla.NombreAlumno;
                model.ApellidoAlumno     = oTabla.ApellidoAlumno;
                model.CalificacionAlumno = oTabla.CalificacionAlumno;
                model.Fecha = oTabla.Fecha;
                model.Id    = oTabla.Id;
            }
            return(View(model));
        }
Esempio n. 20
0
        public ActionResult Editar(int Id)
        {
            TablaViewModel model = new TablaViewModel();

            using (DemoWebEntities db = new DemoWebEntities())
            {
                var oTabla = db.Tabla.Find(Id);
                model.Nombre    = oTabla.Nombre;
                model.Categoria = oTabla.Categoria;

                model.ProgramaId = oTabla.ProgramaId;
            }


            return(View(model));
        }
Esempio n. 21
0
        public ActionResult Editar(int Id)
        {
            TablaViewModel model = new TablaViewModel();

            using (examenEntities db = new examenEntities())
            {
                var oTabla = db.quejas.Find(Id);
                model.Nombre    = oTabla.Nombre;
                model.Matricula = oTabla.matricula;
                model.Campus    = (Campus)oTabla.campus;
                model.Queja     = oTabla.queja1;
                model.Fecha     = oTabla.fecha;
                model.Id        = oTabla.Id;
            }
            return(View(model));
        }
        public ActionResult Editar(int Id)
        {
            TablaViewModel model = new TablaViewModel();

            using (CrudEntities db = new CrudEntities())
            {
                var oTabla = db.operacion.Find(Id);
                model.concepto = oTabla.concepto;
                model.monto    = oTabla.monto;

                model.id_operacion = oTabla.id_operacion;
            }


            return(View(model));
        }
Esempio n. 23
0
        public ActionResult Editar(int id)
        {
            TablaViewModel model = new TablaViewModel();

            using (CrudEntities db = new CrudEntities())
            {
                var oTabla = db.tabla.Find(id);
                model.nombre           = oTabla.nombre;
                model.correo           = oTabla.correo;
                model.fecha_nacimiento = oTabla.fecha_nacimiento;
                model.id = oTabla.id;

                db.Entry(oTabla).State = System.Data.Entity.EntityState.Modified;
                db.SaveChanges();
            }
            return(View(model));
        }
Esempio n. 24
0
        public ActionResult Editar(int id)
        {
            TablaViewModel model = new TablaViewModel();

            using (refugioEntities db = new refugioEntities())
            {
                var gato = db.Gatos.Find(id);

                model.NOMBRE   = gato.NOMBRE;
                model.RAZA     = gato.RAZA;
                model.EDAD     = gato.EDAD;
                model.CASTRADO = gato.CASTRADO;
                model.ID       = gato.ID;
            }

            return(View(model));
        }
Esempio n. 25
0
        public ActionResult New(TablaViewModel model)
        {
            WebService1SoapClient client = new WebService1SoapClient();


            var batch = new batch();

            batch.ID_Movie          = model.ID_Movie;
            batch.Description_Movie = model.Description_Movie;
            batch.Duration          = model.Duration;
            batch.State             = model.State;

            client.AddMovie(model.ID_Movie, model.Description_Movie, model.Duration, model.State);


            return(Redirect("~/Movie/"));
        }
Esempio n. 26
0
        public ActionResult New(TablaViewModel model)
        {
            WebService1SoapClient client = new WebService1SoapClient();


            var room = new Room();

            room.ID_Room     = model.ID_Room;
            room.Description = model.Description;
            room.Capacity    = model.Capacity;
            room.State       = model.State;

            client.AddRoom(model.Description, model.Capacity, model.State);


            return(Redirect("~/Room/"));
        }
Esempio n. 27
0
        public ActionResult Edit(int id)
        {
            WebService1SoapClient client = new WebService1SoapClient();
            TablaViewModel        model  = new TablaViewModel();

            var seat = client.GetSeat(id);


            model.Description_Seat = model.Description_Seat;
            model.ID_Room          = model.ID_Room;
            model.Row     = model.Row;
            model.Number  = model.Number;
            model.Price   = model.Price;
            model.ID_Seat = seat.ID_Seat;


            return(View(model));
        }
Esempio n. 28
0
        public ActionResult Edit(int id)
        {
            TablaViewModel model = new TablaViewModel();

            WebService1SoapClient client = new WebService1SoapClient();


            var movie = client.GetMovie(id);

            model.ID_Movie          = model.ID_Movie;
            model.Description_Movie = model.Description_Movie;
            model.Duration          = model.Duration;
            model.State             = model.State;
            model.ID_Movie          = movie.ID_Movie;


            return(View(model));
        }
Esempio n. 29
0
        public ActionResult Edit(int id)
        {
            WebService1SoapClient client = new WebService1SoapClient();
            TablaViewModel        model  = new TablaViewModel();

            var person = client.GetPerson(id);

            model.Identification = model.Identification;
            model.Name           = model.Name;
            model.Mail           = model.Mail;
            model.Password       = model.Password;
            model.Ind_User       = model.Ind_User;
            model.Points         = model.Points;
            model.ID_Person      = person.ID_Person;


            return(View(model));
        }
Esempio n. 30
0
        public ActionResult New(TablaViewModel model)
        {
            WebService1SoapClient client = new WebService1SoapClient();


            var purchase = new Purchase();

            purchase.ID_Purchase   = model.ID_Purchase;
            purchase.ID_Batch      = model.ID_Batch;
            purchase.ID_Person     = model.ID_Person;
            purchase.Date_Purchase = model.Date_Purchase;


            client.AddPurchase(model.ID_Batch, model.ID_Person, model.Date_Purchase);


            return(Redirect("~/Purchase/"));
        }