public void Edit(Lesson lesson) { var original = this.Find(lesson.Id); original.Author = lesson.Author; original.Title = lesson.Title; original.Description = lesson.Description; _repo.SaveChanges(); HttpRuntime.Cache.Remove(LESSONS_CACHE_KEY); }
public ActionResult Create(Lesson lesson) { var user = User.Identity as ClaimsIdentity; if (!user.HasClaim("CanEdit", "true")) { return new HttpUnauthorizedResult("Hey, Go Away!"); } if (ModelState.IsValid) { _service.Create(lesson); return RedirectToAction("Index"); } return View(); }
public void Create(Lesson lesson) { _repo.Add<Lesson>(lesson); _repo.SaveChanges(); HttpRuntime.Cache.Remove(LESSONS_CACHE_KEY); }