예제 #1
0
        public ActionResult <OfficeCheckInResponse> Update(int id, OfficeCheckInRequest movement)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest());
            }

            if (movement.Custody)
            {
                return(_officeCheckInRepository.UpdateCheckInWithCustody(id, movement));
            }

            if (movement.Failed)
            {
                return(_officeCheckInRepository.UpdateCheckInWithFailure(id, movement));
            }

            if (movement.OfficeToOffice)
            {
                return(_officeCheckInRepository.UpdateLogisticsOnlyCheckIn(id, movement));
            }

            if (movement.MovementType == MovementType.Deposit)
            {
                return(_officeCheckInRepository.UpdateIncomingCheckIn(id, movement));
            }

            if (movement.MovementType == MovementType.Dispatch)
            {
                return(_officeCheckInRepository.UpdateOutgoingCheckIn(id, movement));
            }

            return(BadRequest("The request didn't fulfill any of the conditions to be processed"));
        }
예제 #2
0
        public IActionResult Create(OfficeCheckInRequest movement)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest());
            }

            if (movement.Custody)
            {
                return(_officeCheckInRepository.CreateCheckInWithCustody(movement));
            }

            if (movement.Failed)
            {
                return(_officeCheckInRepository.CreateCheckInWithFailure(movement));
            }

            if (movement.OfficeToOffice)
            {
                return(_officeCheckInRepository.CreateLogisticsOnlyCheckIn(movement));
            }

            if (movement.MovementType == MovementType.Deposit)
            {
                return(_officeCheckInRepository.CreateIncomingCheckIn(movement));
            }

            return(BadRequest("The request didn't fulfill any of the conditions to be processed"));
        }