Exemplo n.º 1
0
        public async Task <ResponseResult> Allocate(SeatAllocat SeatAllocat)
        {
            var res = await _unitOfWork.SeatRepository.Allocate(SeatAllocat);

            if (res != null && res.Equals(Constant.SeatAllocated))
            {
                return(new ResponseResult(200, res, null));
            }
            else if (res != null && res.Equals(Constant.EmployeeExists))
            {
                return(new ResponseResult(403, null, res));
            }
            else if (res != null && res.Equals(Constant.SeatTypeMismatch))
            {
                return(new ResponseResult(409, null, res));
            }
            else if (res != null && res.Equals(Constant.SeatExists))
            {
                return(new ResponseResult(103, null, res));
            }
            else
            {
                return(new ResponseResult(500, null, res));
            }
        }
Exemplo n.º 2
0
        public async Task <IActionResult> Allocate([FromBody] SeatAllocat SeatAllocat)
        {
            try
            {
                if (!ModelState.IsValid)
                {
                    return(BadRequest(ModelState));
                }

                var result = await _seatService.Allocate(SeatAllocat);

                return(StatusCode(result.StatusCode, result));
            }
            catch (Exception ex)
            {
                _logger.LogError(ex.Message);
                throw ex;
            }
        }