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 } }
// GET: Seat public ActionResult Index() { List <ListSeatViewModel> lst; using (DBContextCF db = new DBContextCF()) { try { lst = (from d in db.Seats select new ListSeatViewModel { ID_Seat = d.ID_Seat, ID_Room = d.ID_Room, Description_Seat = d.Description_Seat, Row = d.Row, Number = d.Number, Price = d.Price }).ToList(); } catch (Exception ex) { Console.WriteLine("ServicesMVC_Direct.SeatController.ActionResult_Index" + ex.Message); return(null); //de otra forma retorne nulo } } return(View(lst)); }
// GET: Batch public ActionResult Index() { List <ListBatchViewModel> lst; using (DBContextCF db = new DBContextCF()) { try { lst = (from d in db.Batches select new ListBatchViewModel { ID_Batch = d.ID_Batch, ID_Room = d.ID_Room, ID_Schedule = d.ID_Schedule, ID_Movie = d.ID_Movie, }).ToList(); } catch (Exception ex) { Console.WriteLine("ServicesMVC_Direct.BatchController.ActionResult_Index" + ex.Message); return(null); //de otra forma retorne nulo } return(View(lst)); } }
public ActionResult Edit(int id) { TablaViewModel model = new TablaViewModel(); using (DBContextCF db = new DBContextCF()) { try { var person = db.Persons.Find(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; } catch (Exception ex) { Console.WriteLine("ServicesMVC_Direct.PersonController.ActionResult_Index" + ex.Message); } } return(View(model)); }
// GET: Movie public ActionResult Index() { List <ListMovieViewModel> lst; using (DBContextCF db = new DBContextCF()) { try { lst = (from d in db.Movies select new ListMovieViewModel { ID_Movie = d.ID_Movie, Description_Movie = d.Description_Movie, Duration = d.Duration, State = d.State }).ToList(); return(View(lst)); } catch (Exception ex) { Console.WriteLine("ServicesMVC_Direct.MovieController.ActionResult_Index" + ex.Message); return(null); //de otra forma retorne nulo } } }
public ActionResult Edit(int id) { TablaViewModel model = new TablaViewModel(); using (DBContextCF db = new DBContextCF()) { try { var seat = db.Seats.Find(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; } catch (Exception ex) { Console.WriteLine("ServicesMVC_Direct.SeatController.ActionResult_Edit(int id)" + ex.Message); } } return(View(model)); }
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 } }
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 } }
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 } }
// GET: Room public ActionResult Index() { List <ListRoomViewModel> lst; using (DBContextCF db = new DBContextCF()) { try { lst = (from d in db.Rooms select new ListRoomViewModel { ID_Room = d.ID_Room, Capacity = d.Capacity, Description = d.Description, State = d.State, }).ToList(); } catch (Exception ex) { Console.WriteLine("ServicesMVC_Direct.RoomController.ActionResult_Index" + ex.Message); return(null); //de otra forma retorne nulo } } return(View(lst)); }
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 } }
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 } }
// GET: ClientPurchase public ActionResult Index() { List <ListClientPurchaseViewModel> lst; using (DBContextCF db = new DBContextCF()) { try { lst = (from d in db.Purchases select new ListClientPurchaseViewModel { ID_Purchase = d.ID_Purchase, ID_Batch = d.ID_Batch, ID_Person = d.ID_Person, Date_Purchase = d.Date_Purchase, }).ToList(); } catch (Exception ex) { Console.WriteLine("ServicesMVC_Direct.PurchaseController.ActionResult_Index" + ex.Message); return(null); //de otra forma retorne nulo } } return(View(lst)); }
// GET: Person public ActionResult Index() { List <ListPersonViewModel> lst; using (DBContextCF db = new DBContextCF()) { try { lst = (from d in db.Persons select new ListPersonViewModel { ID_Person = d.ID_Person, Identification = d.Identification, Name = d.Name, Mail = d.Mail, Password = d.Password, Ind_User = d.Ind_User, Points = d.Points }).ToList(); } catch (Exception ex) { Console.WriteLine("ServicesMVC_Direct.PersonController.ActionResult_Index" + ex.Message); return(null); //de otra forma retorne nulo } } return(View(lst)); }
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 } }
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 List <Schedule> GetAllSchedules() { using (DBContextCF context = new DBContextCF()) { var schedule = context.Schedules.ToList(); return(schedule); } }
public List <Person> GetAllPeople() { using (DBContextCF context = new DBContextCF()) { var person = context.Persons.ToList(); return(person); } }
public List <Movie> GetAllMovies() { using (DBContextCF context = new DBContextCF()) { var movie = context.Movies.ToList(); return(movie); } }
public List <Purchase> GetAllPurchases() { using (DBContextCF context = new DBContextCF()) { var purchase = context.Purchases.ToList(); return(purchase); } }
public List <Seat> GetAllSeats() { using (DBContextCF context = new DBContextCF()) { var seat = context.Seats.ToList(); return(seat); } }
public List <Room> GetAllRooms() { using (DBContextCF context = new DBContextCF()) { var room = context.Rooms.ToList(); return(room); } }
public List <Batch> GetAllBatch() { // consulta desd una bd using (DBContextCF context = new DBContextCF()) { var batch = context.Batch.ToList(); return(batch); } }
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); } } }
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); } } }
public Batch GetrById(int IDBatch) { using (DBContextCF context = new DBContextCF()) { try { return(context.Batches.Where(x => x.ID_Batch == IDBatch).SingleOrDefault()); } catch (Exception ex) { Console.WriteLine("BL.Data_Batch.Batch_GetrById" + ex.Message); } } return(null); }
public IEnumerable Get() { using (DBContextCF context = new DBContextCF()) { try { return(context.Batches.ToList()); } catch (Exception ex) { Console.WriteLine("BL.Data_Batch.IEnumerable_Get" + ex.Message); } } return(null); }
public Seat GetrById(int IDSeat) { using (DBContextCF context = new DBContextCF()) { try { return(context.Seats.Where(x => x.ID_Seat == IDSeat).SingleOrDefault()); } catch (Exception ex) { Console.WriteLine("BL.Data_Seat.Seat_GetrById" + ex.Message); } } return(null); }
public Movie GetrById(int IDMovie) { using (DBContextCF context = new DBContextCF()) { try { return(context.Movies.Where(x => x.ID_Movie == IDMovie).SingleOrDefault()); } catch (Exception ex) { Console.WriteLine("BL.Data_Movies.GetrById" + ex.Message); } } return(null); }
public Person GetrById(int IDPerson) { using (DBContextCF context = new DBContextCF()) { try { return(context.Persons.Where(x => x.ID_Person == IDPerson).SingleOrDefault()); } catch (Exception ex) { Console.WriteLine("BL.Data_People.Person_GetrById" + ex.Message); } } return(null); }