Example #1
0
 public void Add(Gig gig)
 {
     using (DbContext context = new DbContext())
     {
         context.Gigs.Add(gig);
         context.SaveChanges();
     }
 }
Example #2
0
 public void Update(Gig gig)
 {
     using (DbContext context = new DbContext())
     {
         context.Entry(gig).State = EntityState.Modified;
         context.SaveChanges();
     }
 }
Example #3
0
        public ActionResult Edit(Gig gig)
        {
            if (ModelState.IsValid)
            {
                gig.ArrivalTime = gig.Date;
                _gigRepository.Update(gig);

                return RedirectToAction("Index");
            }
            return View(gig);
        }
Example #4
0
 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);
 }