public ActionResult Suggest(CreateSuggestionModel model) { try { if (ModelState.IsValid) { model.Suggestion.SuggestByUserId = SessionData.UserId; SuggestionsLogic.InsertNewSuggestion(model.Suggestion); return(PartialView("JavascriptRedirect", new JavascriptRedirectModel("/Developer/Index"))); } CreateSuggestionModel SuggestionModel = SuggestionsLogic.UpdateProjectsList(model); return(PartialView("SuggestPartial", SuggestionModel)); } catch (Exception e) { LogsLogic.InsertLog(new Log() { Message = e.Message, StackTrace = e.StackTrace, StoryName = "ManagementProject/Suggestions/Suggest(Post)", Parameters = new JavaScriptSerializer().Serialize(model) }); return(PartialView("SuggestPartial", model)); } }
public static CreateSuggestionModel UpdateProjectsList(CreateSuggestionModel model) { model.Projects = ProjectsRepositories.GetAllProjects(); model.Projects.Insert(0, (new Project { Name = "General", Id = 0 })); return(model); }
public static CreateSuggestionModel GetEditSuggestionModel(int suggestionId) { CreateSuggestionModel model = new CreateSuggestionModel(); model.Projects = ProjectsRepositories.GetAllProjects(); model.Projects.Insert(0, (new Project { Name = "General", Id = 0 })); model.Suggestion = SuggestionsRepositories.GetSuggestionById(suggestionId); return(model); }
public ActionResult Suggest() { CreateSuggestionModel model = new CreateSuggestionModel(); try { model = SuggestionsLogic.GetCreateSuggestionModel(); } catch (Exception e) { LogsLogic.InsertLog(new Log() { Message = e.Message, StackTrace = e.StackTrace, StoryName = "ManagementProject/Suggestions/Suggest", }); return(RedirectToAction("GeneralError", "Error", new { ErrorMessage = Error.ServerNotRespond })); } return(PartialView("SuggestPartial", model)); }