예제 #1
0
        public async Task FindTest()
        {
            var           testDatepicker = new TestDatepickerDto().Datepicker;
            DatepickerDto result         = await _datepickerLogic.Find(testDatepicker.Uuid);

            Assert.NotNull(result);
        }
예제 #2
0
        public async Task <ActionResult <DatepickerViewmodel> > Find(Guid uuid)
        {
            try
            {
                UserHelper    requestingUser = _controllerHelper.GetRequestingUser(this);
                DatepickerDto datepicker     = await _datepickerLogic.Find(uuid);

                var datepickerViewmodel = _mapper.Map <DatepickerViewmodel>(datepicker);
                datepickerViewmodel.CanBeRemoved = datepicker.AuthorUuid == requestingUser.Uuid;

                return(datepickerViewmodel);
            }
            catch (KeyNotFoundException)
            {
                return(NotFound());
            }
            catch (UnprocessableException)
            {
                return(UnprocessableEntity());
            }
            catch (Exception e)
            {
                _logLogic.Log(e);
                return(StatusCode(StatusCodes.Status500InternalServerError));
            }
        }