Пример #1
0
        public ActionResult UpdateJoke(JokeUpdateModel jokeModel)
        {
            if(!ModelState.IsValid)
            {
                return View();
            }

            var jokeinfo = jokeBusinessLogic.JokeDetailGet(jokeModel.ID);
            jokeinfo.Title =jokeModel.Title;
            jokeinfo.Content = jokeModel.Content;
            jokeinfo.Category = jokeModel.Category;

            bool updateResult=jokeBusinessLogic.UpdateJoke(jokeinfo);
            return RedirectToAction("Detail", new { id=jokeModel.ID});
        }
Пример #2
0
 public ActionResult UpdateJoke(int jokeid)
 {
     var jokeinfo = jokeBusinessLogic.JokeDetailGet(jokeid);
     JokeUpdateModel jokeModel = new JokeUpdateModel() {
       ID = jokeinfo.ID, Title = jokeinfo.Title,Content = jokeinfo.Content,Type = jokeinfo.Type,Category = jokeinfo.Category
     };
     var categoryDtos = jokeBusinessLogic.GetCategoryList();
     ViewBag.Categories = categoryDtos;
     return View(jokeModel);
 }