public IActionResult OnPost() { UploadThumb(); if (!ModelState.IsValid) { ProjectTags = _htmlHelper.GetEnumSelectList <ProjectTag>(); return(Page()); } if (PersonalProject.Id > 0) { _projectData.UpdatePersonalProject(PersonalProject); _projectData.Commit(); PPTag.PersonalProjectId = PersonalProject.Id; _projectData.UpdateTags(PPTag); } else { _projectData.AddPersonalProject(PersonalProject); _projectData.Commit(); PPTag.PersonalProjectId = PersonalProject.Id; _projectData.AddTags(PPTag); } _projectData.Commit(); return(RedirectToPage("/CMS/Projects/ProjectsList")); }
public IActionResult OnPost() { UploadThumb(); if (!ModelState.IsValid) { Categories = _htmlHelper.GetEnumSelectList <FccCategory>(); return(Page()); } if (FreeCodeCampProject.Id > 0) { _projectData.UpdateFccProject(FreeCodeCampProject); } else { _projectData.AddFccProject(FreeCodeCampProject); } _projectData.Commit(); return(RedirectToPage("/CMS/Projects/ProjectsList")); }
public IActionResult OnPost() { if (!ModelState.IsValid) { //busca os enums Types = htmlHelper.GetEnumSelectList <ProjectType>(); return(Page()); } if (Project.Id > 0) { Project = _ProjectData.Update(Project); } else { Project.CreationDate = DateTime.Now.ToShortDateString(); _ProjectData.Create(Project); } _ProjectData.Commit(); TempData["Message"] = "Projeto salvo!!!"; return(RedirectToPage("./Detail", new { projectId = Project.Id })); }
public IActionResult OnPost() { if (!ModelState.IsValid) { return(Page()); } if (Project.ProjectId > 0) { _projectData.Update(Project); TempData["Message"] = "Project updated!"; } else { var userId = this.User.FindFirstValue(ClaimTypes.NameIdentifier); _projectData.New(Project, userId); TempData["Message"] = "Project added!"; } _projectData.Commit(); return(Page()); //return RedirectToPage("./Detail", new { taskId = Project.ProjectId }); }