コード例 #1
0
 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);
 }
コード例 #2
0
        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();
        }
コード例 #3
0
 public void Create(Lesson lesson)
 {
     _repo.Add<Lesson>(lesson);
     _repo.SaveChanges();
     HttpRuntime.Cache.Remove(LESSONS_CACHE_KEY);
 }