public ActionResult Create(Site site) { if (ModelState.IsValid) { repo.Add(site); repo.SaveChanges(); TempData["Message"] = "Site Saved"; return RedirectToAction("Index"); } ViewBag.Organizations = repo.Organizations.ToSelectListItems(includeAllOption: false); return View(site); }
private void VerifySiteFilter(ICurrentUser currentUser, Site Site, bool expectedResult) { var filter = DataContextExtensions.GetSiteFilterForCurrentUser(currentUser); var actualResult = filter(Site); Assert.AreEqual(expectedResult, actualResult); }
public DbEntityEntry<Site> Entry(Site entity) { HttpContext.Current.Cache.Remove("Sites"); // invalidate cache return db.Entry<Site>(entity); }
public Site Remove(Site entity) { HttpContext.Current.Cache.Remove("Sites"); // invalidate cache Entry(entity).State = System.Data.EntityState.Deleted; return entity; }
public Site Add(Site entity) { HttpContext.Current.Cache.Remove("Sites"); // invalidate cache return db.Sites.Add(entity); }