public void AssignToUser(string requestId, string responsiblePersonId)
        {
            var dbRequest = _zoneValidationRequestRepository.GetById(requestId);

            if (dbRequest == null)
            {
                throw new ArgumentOutOfRangeException(nameof(dbRequest.Id), "Invalid ZoneValidationRequestId.");
            }

            if (dbRequest.Status >= ZoneValidationStatus.Declined)
            {
                throw new ArgumentOutOfRangeException(nameof(requestId), "You cannot assign closed request.");
            }

            dbRequest.ResponsiblePersonId = responsiblePersonId;
            dbRequest.Status = ZoneValidationStatus.InProgress;

            _zoneValidationRequestRepository.Update(dbRequest);
        }
Example #2
0
        public void CancelZoneRequest(string requestId, string requestPersonId)
        {
            var dbRequest = _zoneValidationRequestRepository.GetById(requestId);

            if (dbRequest == null)
            {
                throw new ArgumentOutOfRangeException(nameof(dbRequest.Id), "Invalid ZoneValidationRequestId.");
            }

            if (dbRequest.RequesterId != requestPersonId)
            {
                throw new ArgumentOutOfRangeException(nameof(dbRequest.RequesterId), "You haven't permissions to modify requests of this zone.");
            }

            if (dbRequest.Status >= ZoneValidationStatus.Declined)
            {
                throw new ArgumentOutOfRangeException(nameof(requestId), "You cannot cancel closed request.");
            }

            dbRequest.Status = ZoneValidationStatus.Canceled;

            _zoneValidationRequestRepository.Update(dbRequest);
        }