public ActionResult Edit(TablaViewModel model) { try { if (ModelState.IsValid) { using (DBContextCF db = new DBContextCF()) { var purchase = db.Purchases.Find(model.ID_Purchase); purchase.ID_Batch = model.ID_Batch; purchase.ID_Person = model.ID_Person; purchase.Date_Purchase = model.Date_Purchase; db.Entry(purchase).State = System.Data.Entity.EntityState.Modified; db.SaveChanges(); } return(Redirect("~/Purchase/")); } return(View(model)); } catch (Exception ex) { Console.WriteLine("ServicesMVC_Direct.PurchaseController.ActionResult_Edit(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 movie = db.Movies.Find(model.ID_Movie); movie.Description_Movie = model.Description_Movie; movie.Duration = model.Duration; movie.State = model.State; db.Entry(movie).State = System.Data.Entity.EntityState.Modified; 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 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 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 } }
public ActionResult Edit(TablaViewModel model) { try { if (ModelState.IsValid) { using (DBContextCF db = new DBContextCF()) { var person = db.Persons.Find(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.Entry(person).State = System.Data.Entity.EntityState.Modified; db.SaveChanges(); } return(Redirect("~/Person/")); } return(View(model)); } catch (Exception ex) { Console.WriteLine("ServicesMVC_Direct.PersonController.ActionResult_Edit(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 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 } }
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); } } }