public async Task <ActionResult <ProjectDto> > Create([Required] ProjectDto project) { var myProj = new Project { Description = project.Description, Title = project.Title, CreationDate = DateTimeOffset.Now }; await _projectDatabase.Add(myProj); return(ProjectDto.FromProject(myProj)); }
// To protect from overposting attacks, enable the specific properties you want to bind to, for // more details, see https://aka.ms/RazorPagesCRUD. public async Task <IActionResult> OnPostAsync() { if (!ModelState.IsValid) { return(Page()); } Project.CreationDate = DateTime.Now; await _context.Add(Project); return(RedirectToPage("./Index")); }