Exemple #1
0
        public async Task <int> Create(WebsiteProxy websiteProxy)
        {
            WebsiteValidator.ValidateOnUpdateOrCreate(websiteProxy);

            var id = await WebsiteRepository.Create(websiteProxy);

            return(id);
        }
Exemple #2
0
        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);
        }
Exemple #3
0
        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);
        }