public void Add(Gig gig) { using (DbContext context = new DbContext()) { context.Gigs.Add(gig); context.SaveChanges(); } }
public void Update(Gig gig) { using (DbContext context = new DbContext()) { context.Entry(gig).State = EntityState.Modified; context.SaveChanges(); } }
public ActionResult Edit(Gig gig) { if (ModelState.IsValid) { gig.ArrivalTime = gig.Date; _gigRepository.Update(gig); return RedirectToAction("Index"); } return View(gig); }
public ActionResult Create(Gig gig) { if (ModelState.IsValid) { gig.Date = new DateTime(gig.Date.Year, gig.Date.Month, gig.Date.Day, int.Parse(Request.Form["StartHour"]), int.Parse(Request.Form["StartMinutes"]),0); gig.ArrivalTime = new DateTime(gig.Date.Year, gig.Date.Month, gig.Date.Day, int.Parse(Request.Form["ArrivalHour"]), int.Parse(Request.Form["ArrivalMinutes"]), 0); _gigRepository.Add(gig); return RedirectToAction("Index"); } return View(gig); }