public async Task <int> Create(WebsiteProxy websiteProxy) { WebsiteValidator.ValidateOnUpdateOrCreate(websiteProxy); var id = await WebsiteRepository.Create(websiteProxy); return(id); }
public async Task <WebsiteProxy> Patch(WebsiteProxy websiteProxy) { WebsiteValidator.ValidateOnPatch(websiteProxy); var updatedObject = await WebsiteRepository.Patch(websiteProxy); if (updatedObject is null) { throw new NotFoundError($"Update Failed. Website with id {websiteProxy.Id} not found"); } return(updatedObject); }
public async Task <WebsiteProxy> Update(WebsiteProxy websiteProxy) { if (websiteProxy.Id == 0) { throw new NotFoundError($"Update Failed. Website {websiteProxy.Id} not provided"); } WebsiteValidator.ValidateOnUpdateOrCreate(websiteProxy); var updatedObject = await WebsiteRepository.Update(websiteProxy); if (updatedObject is null) { throw new NotFoundError($"Update Failed. Website with id {websiteProxy.Id} not found"); } return(updatedObject); }