Пример #1
0
        public async Task <IHttpActionResult> Update(EditProjectViewModel viewModel)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            var dto = _mapper.Map <EditProjectViewModel, EditProjectDto>(viewModel);

            SetOrganizationAndUser(dto);

            try
            {
                await _projectsService.EditProjectAsync(dto);

                return(Ok());
            }
            catch (ValidationException e)
            {
                return(BadRequestWithError(e));
            }
            catch (UnauthorizedException)
            {
                return(Forbidden());
            }
        }