예제 #1
0
        public IHttpActionResult UpdateLinks(AddEditDeleteExternalLinkViewModel updateLinksViewModel)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            var updateLinksDto = _mapper.Map <AddEditDeleteExternalLinkViewModel, AddEditDeleteExternalLinkDTO>(updateLinksViewModel);

            SetOrganizationAndUser(updateLinksDto);

            try
            {
                _externalLinkService.UpdateLinks(updateLinksDto);
            }
            catch (ValidationException e)
            {
                return(BadRequestWithError(e));
            }

            var cache = Configuration.CacheOutputConfiguration().GetCacheOutputProvider(Request);

            cache.RemoveStartsWith(Configuration.CacheOutputConfiguration().MakeBaseCachekey((ExternalLinkController t) => t.GetAll()));

            return(Ok());
        }
        public async Task <IHttpActionResult> UpdateLinks(AddEditDeleteExternalLinkViewModel updateLinksViewModel)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            var updateLinksDto = _mapper.Map <AddEditDeleteExternalLinkViewModel, AddEditDeleteExternalLinkDto>(updateLinksViewModel);

            SetOrganizationAndUser(updateLinksDto);

            try
            {
                await _externalLinkService.UpdateLinksAsync(updateLinksDto);
            }
            catch (ValidationException e)
            {
                return(BadRequestWithError(e));
            }

            return(Ok());
        }