public async Task <SingleResourceDto> InsertResource(ResourceCreateInputDto resourceCreateInputDto) { try { var resource = new Resource() { FirstName = resourceCreateInputDto.FirstName, LastName = resourceCreateInputDto.LastName, DateOfBirth = resourceCreateInputDto.DateOfBirth, Address = resourceCreateInputDto.Address, }; _context.Resource.Add(resource); await _context.SaveChangesAsync(); var result = new SingleResourceDto() { Id = resource.Id, FirstName = resourceCreateInputDto.FirstName, LastName = resourceCreateInputDto.LastName, DateOfBirth = resourceCreateInputDto.DateOfBirth, Address = resourceCreateInputDto.Address, }; return(result); } catch (Exception ex) { throw ex; } }
public async Task <ActionResult <SingleResourceDto> > InsertResource(ResourceCreateInputDto resourceInput) { var resourceResult = await _resourceRepository.InsertResource(resourceInput); return(resourceResult); }