public ActionResult Edit(Service service)
 {
     if (ModelState.IsValid)
     {
         repo.Entry(service).State = EntityState.Modified;
         repo.SaveChanges();
         TempData["Message"] = "Service Saved";
         return RedirectToAction("Index");
     }
     return View(service);
 }
        public ActionResult Create(Service service)
        {
            if (ModelState.IsValid)
            {
                repo.Add(service);
                repo.SaveChanges();
                TempData["Message"] = "Service Saved";
                return RedirectToAction("Index");
            }

            return View(service);
        }
Beispiel #3
0
 public DbEntityEntry<Service> Entry(Service entity)
 {
     HttpContext.Current.Cache.Remove("Services"); // invalidate cache
     return db.Entry<Service>(entity);
 }
Beispiel #4
0
 public Service Remove(Service entity)
 {
     HttpContext.Current.Cache.Remove("Services"); // invalidate cache
     Entry(entity).State = System.Data.EntityState.Deleted;
     return entity;
 }
Beispiel #5
0
 public Service Add(Service entity)
 {
     HttpContext.Current.Cache.Remove("Services"); // invalidate cache
     return db.Services.Add(entity);
 }