public bool UpdateDiscusion(Discussion discussion) { throw new NotImplementedException(); }
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); } }
public bool AddDiscussion(Discussion discussion) { return discussionRepository.Insert(discussion); }