コード例 #1
0
 public ActionResult Edit(Servicer servicer)
 {
     if (ModelState.IsValid)
     {
         repo.Entry(servicer).State = EntityState.Modified;
         repo.SaveChanges();
         TempData["Message"] = "Employee Saved";
         return RedirectToAction("Index");
     }
     return View(servicer);
 }
コード例 #2
0
        public ActionResult Create(Servicer servicer)
        {
            if (ModelState.IsValid)
            {
                repo.Add(servicer);
                repo.SaveChanges();
                TempData["Message"] = "Employee Saved";
                return RedirectToAction("Index");
            }

            return View(servicer);
        }
コード例 #3
0
ファイル: Repo.cs プロジェクト: mharen/service-tracker
 public Servicer Remove(Servicer entity)
 {
     HttpContext.Current.Cache.Remove("Servicers"); // invalidate cache
     Entry(entity).State = System.Data.EntityState.Deleted;
     return entity;
 }
コード例 #4
0
ファイル: Repo.cs プロジェクト: mharen/service-tracker
 public DbEntityEntry<Servicer> Entry(Servicer entity)
 {
     HttpContext.Current.Cache.Remove("Servicers"); // invalidate cache
     return db.Entry<Servicer>(entity);
 }
コード例 #5
0
ファイル: Repo.cs プロジェクト: mharen/service-tracker
 public Servicer Add(Servicer entity)
 {
     HttpContext.Current.Cache.Remove("Servicers"); // invalidate cache
     return db.Servicers.Add(entity);
 }
 private void VerifyServicerFilter(ICurrentUser currentUser, Servicer servicer, bool expectedResult)
 {
     var filter = DataContextExtensions.GetServicerFilterForCurrentUser(currentUser);
     var actualResult = filter(servicer);
     Assert.AreEqual(expectedResult, actualResult);
 }