Exemplo n.º 1
0
        public async Task <IHttpActionResult> CloseBooking(RentoRequest <CloseBooking> request)
        {
            Logger.Debug("CloseBooking", request);

            return(Ok(await TryCatchResponseBase(request, ValidateType.Active, async(RentoResponse response) =>
            {
                if (!ValidateRequirdField(request.Data.CheckoutId)
                    ||
                    !ValidateRequirdField(request.Data.Star)
                    ||
                    (request.Data.Flag == (int)CheckoutFlag.Rejected && !ValidateRequirdField(request.Data.Comment)))
                {
                    response.ErrorCode = ErrorCode.RequirdField;
                    return;
                }
                if (request.Data.Flag == (int)CheckoutFlag.GetFromOffice || request.Data.Flag == (int)CheckoutFlag.Rejected)
                {
                    request.Data.Flag = (int)CheckoutFlag.CustomerRejected;
                }
                await CarManager.CloseBooking(UserSession.Id, request.Data);
            })));
        }