예제 #1
0
        public async Task <IHttpActionResult> CreateType(NewKudosTypeViewModel model)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            var dto = _mapper.Map <NewKudosTypeViewModel, NewKudosTypeDto>(model);

            SetOrganizationAndUser(dto);

            try
            {
                await _kudosService.CreateKudosTypeAsync(dto);

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