示例#1
0
 public bool UpdateDiscusion(Discussion discussion)
 {
     throw new NotImplementedException();
 }
示例#2
0
 public virtual ActionResult Create(CreateDiscussionVM discussionVM)
 {
     if (ModelState.IsValid)
     {
         // create new problem
         Discussion d = new Discussion();
         d.UserId = _authenticationService.GetUserId();
         d.Title = discussionVM.Title;
         d.Content = discussionVM.Content;
         d.DateCreated = DateTime.Now;
         d.DateModified = DateTime.Now;
         bool res = _discussionComandService.AddDiscussion(d);
         if (!res)
         {
             // by some reason. cannot create discussion
             ModelState.AddModelError("create_discussion_exception", "This discussion cannot be created. Try again later");
             return View("Views/CreateDiscussion",discussionVM);
         }
         else
         {
             return Detail(d.Id);
         }
     }
     else
     {
         // if not ModelState valid
         ModelState.AddModelError("model_state_invalid", "Current State is Invalid");
         return View("Views/CreateDiscussion", discussionVM);
     }
 }
示例#3
0
 public bool AddDiscussion(Discussion discussion)
 {
     return discussionRepository.Insert(discussion);
 }