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
            }
        }
Exemple #2
0
        public ActionResult Edit(TablaViewModel model)
        {
            try
            {
                if (ModelState.IsValid)
                {
                    using (DBContextCF db = new DBContextCF())
                    {
                        var seat = db.Seats.Find(model.ID_Seat);
                        seat.ID_Room          = model.ID_Room;
                        seat.Description_Seat = model.Description_Seat;
                        seat.Row    = model.Row;
                        seat.Number = model.Number;
                        seat.Price  = model.Price;


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

                    return(Redirect("~/Seat/"));
                }
                return(View(model));
            }
            catch (Exception ex)
            {
                Console.WriteLine("ServicesMVC_Direct.SeatController.ActionResult_Edit(TablaViewModel model)" + ex.Message);
                return(null); //de otra forma retorne nulo
            }
        }
Exemple #3
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
            }
        }
Exemple #4
0
        public ActionResult New(TablaViewModel model)
        {
            try
            {
                if (ModelState.IsValid)
                {
                    using (DBContextCF db = new DBContextCF())
                    {
                        var movie = new Movie();
                        movie.ID_Movie          = model.ID_Movie;
                        movie.Description_Movie = model.Description_Movie;
                        movie.Duration          = model.Duration;
                        movie.State             = model.State;


                        db.Movies.Add(movie);
                        db.SaveChanges();
                    }
                    return(Redirect("~/Movie/"));
                }

                return(View(model));
            }
            catch (Exception ex)
            {
                Console.WriteLine("ServicesMVC_Direct.MovieController.ActionResult_New(TablaViewModel model)" + ex.Message);
                return(null); //de otra forma retorne nulo
            }
        }
Exemple #5
0
        public ActionResult New(TablaViewModel model)
        {
            try
            {
                if (ModelState.IsValid)
                {
                    using (DBContextCF db = new DBContextCF())
                    {
                        var person = new Person();
                        person.ID_Person      = 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;

                        db.Persons.Add(person);
                        db.SaveChanges();
                    }
                    return(Redirect("~/Person/"));
                }

                return(View(model));
            } catch (Exception ex)
            {
                Console.WriteLine("ServicesMVC_Direct.PersonController.ActionResult_New(TablaViewModel model)" + ex.Message);
                return(null); //de otra forma retorne nulo
            }
        }
Exemple #6
0
        public ActionResult New(TablaViewModel model)
        {
            try
            {
                if (ModelState.IsValid)
                {
                    using (DBContextCF db = new DBContextCF())
                    {
                        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;


                        db.Purchases.Add(purchase);
                        db.SaveChanges();
                    }
                    return(Redirect("~/Purchase/"));
                }

                return(View(model));
            }
            catch (Exception ex)
            {
                Console.WriteLine("ServicesMVC_Direct.PurchaseController.ActionResult_New" + ex.Message);
                return(null); //de otra forma retorne nulo
            }
        }
        public ActionResult Edit(TablaViewModel model)
        {
            try
            {
                if (ModelState.IsValid)
                {
                    using (DBContextCF db = new DBContextCF())
                    {
                        var purchase_seat = db.Purchase_Seats.Find(model.ID_Purchase_Seat);
                        purchase_seat.ID_Purchase = model.ID_Purchase;
                        purchase_seat.ID_Seat     = model.ID_Seat;


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

                    return(Redirect("~/PurchaseSeat/"));
                }
                return(View(model));
            }
            catch (Exception ex)
            {
                Console.WriteLine("ServicesMVC_Direct.PurchaseSeatController.ActionResult_Edit(TablaViewModel model)" + ex.Message);
                return(null); //de otra forma retorne nulo
            }
        }
Exemple #8
0
        public ActionResult Edit(TablaViewModel model)
        {
            try
            {
                if (ModelState.IsValid)
                {
                    using (DBContextCF db = new DBContextCF())
                    {
                        var room = db.Rooms.Find(model.ID_Room);
                        room.Capacity    = model.Capacity;
                        room.Description = model.Description;
                        room.State       = model.State;



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

                    return(Redirect("~/Room/"));
                }
                return(View(model));
            }
            catch (Exception ex)
            {
                Console.WriteLine("ServicesMVC_Direct.RoomController.ActionResult_Edit(TablaViewModel model)" + ex.Message);
                return(null); //de otra forma retorne nulo
            }
        }
Exemple #9
0
 //Metodo para eliminar Personas
 public static string EliminarPersona(int idremove)
 {
     using (DBContextCF context = new DBContextCF())
         try
         {
             var persona = context.Personas.Where(x => x.ID == idremove).SingleOrDefault();
             context.Personas.Remove(persona);
             context.SaveChanges();
             return("");
         }
         catch (Exception exp)
         {
             return("Error Eliminar Persona: " + exp.Message);
         }
 }
Exemple #10
0
 //Metodo para eliminar Direcciones
 public static string EliminarDireccion(int idremovedir, int idremoveper)
 {
     using (DBContextCF context = new DBContextCF())
         try
         {
             var direc = context.Direcciones.Where(x => x.ID == idremovedir && x.IDPersona == idremoveper).SingleOrDefault();
             context.Direcciones.Remove(direc);
             context.SaveChanges();
             return("");
         }
         catch (Exception exp)
         {
             return("Error Eliminar Direccion: " + exp.Message);
         }
 }
Exemple #11
0
 public void Update(Batch item)
 {
     using (DBContextCF context = new DBContextCF())
     {
         try
         {
             context.Entry(item).State = EntityState.Modified;
             context.SaveChanges();
         }
         catch (Exception ex)
         {
             Console.WriteLine("BL.Data_Batch.Update" + ex.Message);
         }
     }
 }
Exemple #12
0
 public void Insert(Batch item)
 {
     using (DBContextCF context = new DBContextCF())
     {
         try
         {
             context.Batches.Add(item);
             context.SaveChanges();
         }
         catch (Exception ex)
         {
             Console.WriteLine("BL.Data_Batch.Insert" + ex.Message);
         }
     }
 }
Exemple #13
0
 //Metodo para Actualizar Personas
 public static string ActualizaPersona(int id, string nombre, string apellido, int telefono)
 {
     using (DBContextCF context = new DBContextCF())
         try
         {
             var persona = context.Personas.Where(x => x.ID == id).SingleOrDefault();
             persona.ID       = id;
             persona.Nombre   = nombre;
             persona.Apellido = apellido;
             persona.Telefono = telefono;
             context.SaveChanges();
             return("");
         }
         catch (Exception exp)
         {
             return("Error Actualizar Persona: " + exp.Message);
         }
 }
Exemple #14
0
 public void Delete(int IDBatch)
 {
     using (DBContextCF context = new DBContextCF())
     {
         try
         {
             var toDelete = context.Batches.Where(x => x.ID_Batch == IDBatch).SingleOrDefault();
             if (toDelete != null)
             {
                 context.Batches.Remove(toDelete);
                 context.SaveChanges();
             }
         }
         catch (Exception ex)
         {
             Console.WriteLine("BL.Data_Batch.Delete" + ex.Message);
         }
     }
 }
Exemple #15
0
        public ActionResult Delete(int id)
        {
            TablaViewModel model = new TablaViewModel();

            using (DBContextCF db = new DBContextCF())
            {
                try
                {
                    var schedule = db.Schedules.Find(id);
                    db.Schedules.Remove(schedule);
                    db.SaveChanges();
                }
                catch (Exception ex)
                {
                    Console.WriteLine("ServicesMVC_Direct.ScheduleController.ActionResult_Delete" + ex.Message);
                }
            }
            return(Redirect("~/Schedule/"));
        }
        public ActionResult Delete(int id)
        {
            TablaViewModel model = new TablaViewModel();

            using (DBContextCF db = new DBContextCF())
            {
                try
                {
                    var purchase_seat = db.Purchase_Seats.Find(id);
                    db.Purchase_Seats.Remove(purchase_seat);
                    db.SaveChanges();
                }
                catch (Exception ex)
                {
                    Console.WriteLine("ServicesMVC_Direct.PurchaseSeatController.ActionResult_Delete" + ex.Message);
                }
            }
            return(Redirect("~/Person/"));
        }
Exemple #17
0
 //Metodo para insertar Personas
 public static string AgregarPersona(string nombre, string apellido, int telefono)
 {
     using (DBContextCF context = new DBContextCF())
         try
         {
             var persona = new Datos_Persona();
             //persona.ID = id;
             persona.Nombre   = nombre;
             persona.Apellido = apellido;
             persona.Telefono = telefono;
             context.Personas.Add(persona);
             context.SaveChanges();
             return("");
         }
         catch (Exception exp)
         {
             return("Error Insertar Persona: " + exp.Message);
         }
 }
Exemple #18
0
        public ActionResult Delete(int id)
        {
            TablaViewModel model = new TablaViewModel();

            using (DBContextCF db = new DBContextCF())
            {
                try
                {
                    var movie = db.Movies.Find(id);
                    db.Movies.Remove(movie);
                    db.SaveChanges();
                    return(Redirect("~/Movie/"));
                }
                catch (Exception ex)
                {
                    Console.WriteLine("ServicesMVC_Direct.MovieController.ActionResult_Delete" + ex.Message);
                    return(null);            //de otra forma retorne nulo
                }
            }
        }
Exemple #19
0
 //Metodo para Actualizar Direciones
 public static string ActualizaDirecciones(int id, int idpersona, string pais, string provincia, string canton, string distrito, string detalle)
 {
     using (DBContextCF context = new DBContextCF())
         try
         {
             var direcciones = context.Direcciones.Where(x => x.ID == id && x.IDPersona == idpersona).SingleOrDefault();
             direcciones.ID        = id;
             direcciones.IDPersona = idpersona;
             direcciones.Pais      = pais;
             direcciones.Provincia = provincia;
             direcciones.Canton    = canton;
             direcciones.Distrito  = distrito;
             direcciones.Detalle   = detalle;
             context.SaveChanges();
             return("");
         }
         catch (Exception exp)
         {
             return("Error Actualizar Direccion: " + exp.Message);
         }
 }
Exemple #20
0
 //Metodo para insertar Direcciones
 public static string AgregarDireccion(int iddireccion, int idpersona, string pais, string provincia,
                                       string canton, string distrito, string detalle)
 {
     using (DBContextCF context = new DBContextCF())
         try
         {
             var direccion = new Direccion();
             direccion.ID        = iddireccion;
             direccion.IDPersona = idpersona;
             direccion.Pais      = pais;
             direccion.Provincia = provincia;
             direccion.Canton    = canton;
             direccion.Distrito  = distrito;
             direccion.Detalle   = detalle;
             context.Direcciones.Add(direccion);
             context.SaveChanges();
             return("");
         }
         catch (Exception exp)
         {
             return("Error Insertar Direccion: " + exp.Message);
         }
 }
Exemple #21
0
        public ActionResult New(TablaViewModel model)
        {
            try
            {
                if (ModelState.IsValid)
                {
                    using (DBContextCF db = new DBContextCF())
                    {
                        try
                        {
                            var seat = new Seat();
                            seat.ID_Seat          = model.ID_Seat;
                            seat.ID_Room          = model.ID_Room;
                            seat.Description_Seat = model.Description_Seat;
                            seat.Row    = model.Row;
                            seat.Number = model.Number;
                            seat.Price  = model.Price;

                            db.Seats.Add(seat);
                            db.SaveChanges();
                        }
                        catch (Exception ex)
                        {
                            Console.WriteLine("ServicesMVC_Direct.SeatController.ActionResult_New" + ex.Message);
                        }
                    }
                    return(Redirect("~/Seat/"));
                }

                return(View(model));
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
        }