Example #1
0
 public ActionResult Create(FAQViewModel model)
 {
     if (ModelState.IsValid)
     {
         var userId = User.Identity.GetUserId();
         model.UserId       = User.Identity.GetUserId();
         model.CreateAtUtc  = DateTime.Now;
         model.UpdatedAtUtc = DateTime.Now;
         var faq = new FAQ(model);
         _faqRepository.Add(faq);
         _faqRepository.Save();
         return(RedirectToAction("Index"));
     }
     AddToViewBag();
     return(View("Create", model));
 }