public async Task <ASProject> AddProject(ASProject project) { await _context.ASProjects.AddAsync(project); await _context.SaveChangesAsync(); return(project); }
public async Task <IActionResult> AddProject([FromBody] ASProjectForNewProjectDto project) { var asProject = new ASProject { ProjectName = project.ProjectName, Description = project.Description, GitHubLink = project.GitHubLink, LiveSiteLink = project.LiveSiteLink, DateCreated = DateTime.Now }; var result = await _repo.AddProject(asProject); return(Ok(result)); }
public async Task <ASProject> UpdateProject(ASProject project) { var asProject = await _context.ASProjects.FirstOrDefaultAsync(a => a.Id == project.Id); asProject.ProjectName = project.ProjectName; asProject.Description = project.Description; asProject.GitHubLink = project.GitHubLink; asProject.LiveSiteLink = project.LiveSiteLink; await _context.SaveChangesAsync(); return(project); }