Exemple #1
0
        public void AddOrUpdateAsyncTest()
        {
            var testUser       = new TestUser().User;
            var testDatepicker = new TestDatepickerDto().Datepicker;
            var availableDates = testDatepicker.Dates
                                 .Select(d => d.Uuid)
                                 .ToList();

            Assert.DoesNotThrowAsync(() => _datepickerAvailabilityLogicTest.AddOrUpdateAsync(availableDates, testDatepicker.Uuid, testUser));
        }
Exemple #2
0
        public async Task <ActionResult> AddOrUpdate([FromBody] UserAvailability availability)
        {
            try
            {
                UserHelper requestingUser = _controllerHelper.GetRequestingUser(this);
                await _datepickerAvailabilityLogic.AddOrUpdateAsync(availability.AvailableDates, availability.DatepickerUuid, requestingUser);

                return(Ok());
            }
            catch (ArgumentNullException e)
            {
                _logLogic.Log(e);
                return(StatusCode(StatusCodes.Status304NotModified));
            }
            catch (Exception e)
            {
                _logLogic.Log(e);
                return(StatusCode(StatusCodes.Status500InternalServerError));
            }
        }