예제 #1
0
        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);
 }
예제 #3
0
 public DbEntityEntry<Site> Entry(Site entity)
 {
     HttpContext.Current.Cache.Remove("Sites"); // invalidate cache
     return db.Entry<Site>(entity);
 }
예제 #4
0
 public Site Remove(Site entity)
 {
     HttpContext.Current.Cache.Remove("Sites"); // invalidate cache
     Entry(entity).State = System.Data.EntityState.Deleted;
     return entity;
 }
예제 #5
0
 public Site Add(Site entity)
 {
     HttpContext.Current.Cache.Remove("Sites"); // invalidate cache
     return db.Sites.Add(entity);
 }