Example #1
0
        public async Task <CheckinDto> CheckInToPlayground(CheckInForCreationDto checkInForCreation)
        {
            var checkIn = _mapper.Map <CheckIn>(checkInForCreation);
            await _checkInRepository.Add(checkIn);

            // Eager load Member and Playground entities
            checkIn = await _checkInRepository.SingleOrDefault(
                predicate : c => c.Id == checkIn.Id,
                includeProperties : new Expression <Func <CheckIn, object> >[] { (c => c.Member), (c => c.Playground) });

            return(_mapper.Map <CheckinDto>(checkIn));
        }
Example #2
0
        public async Task <IActionResult> CheckIn(CheckInForCreationDto checkInForCreation)
        {
            if (checkInForCreation == null)
            {
                return(BadRequest());
            }

            var memberIdStr = User.FindFirst(ClaimTypes.NameIdentifier).Value;

            checkInForCreation.MemberId = int.Parse(memberIdStr);
            return(StatusCode(201, await this._manager.CheckInToPlayground(checkInForCreation)));
        }