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

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