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)); }
public async Task <bool> AddProjectAsync(Project project) { var proj = await ApiAccess.AddNewProject(ProjectDto.FromProject(project)); if (proj.Id == null || proj.CreationDate == null) { return(false); } project.Id = proj.Id.Value; project.CreationDate = proj.CreationDate.Value; return(true); }
public async Task <ActionResult <ProjectDto> > Get([Required] int id) { var proj = await _projectDatabase.FindOrDefault(id); if (proj == null) { return(NotFound()); } else { return(ProjectDto.FromProject(proj)); } }
public ActionResult <List <ProjectDto> > Get() { return(_projectDatabase.GetAll().Select(d => ProjectDto.FromProject(d)).ToList()); }