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);
        }
Exemplo n.º 3
0
 public Organization Remove(Organization entity)
 {
     HttpContext.Current.Cache.Remove("Organizations"); // invalidate cache
     Entry(entity).State = System.Data.EntityState.Deleted;
     return entity;
 }
Exemplo n.º 4
0
 public DbEntityEntry<Organization> Entry(Organization entity)
 {
     HttpContext.Current.Cache.Remove("Organizations"); // invalidate cache
     return db.Entry<Organization>(entity);
 }
Exemplo n.º 5
0
 public Organization Add(Organization entity)
 {
     HttpContext.Current.Cache.Remove("Organizations"); // invalidate cache
     return db.Organizations.Add(entity);
 }