Пример #1
0
        public IOperationResult UpdateEventType(EventType eventType)
        {
            Result.Reset();

            Result = eventTypeContext.Update(eventType);

            if (Result.IsError)
            {
                Result = eventTypeContext.Result;
                Result.CustomMessage = "There was a problem updating the requested EventType";
            }

            return(Result);
        }
Пример #2
0
 public IActionResult Update([FromBody] EventType eventType)
 {
     try
     {
         _eventTypeRepo.Update(eventType);
         return(Ok());
     }
     catch (ArgumentException)
     {
         return(NotFound());
     }
     catch (Exception)
     {
         return(StatusCode(500, "Server problem encountered"));
     }
 }
Пример #3
0
        public new ValidationResult Update(EventType eventType)
        {
            var validationResult = new ValidationResult();

            if (!eventType.IsValid())
            {
                validationResult.AddError(eventType.ValidationResult);
                return(validationResult);
            }

            var validator         = new EventTypeIsVerifiedForRegistration();
            var validationService = validator.Validate(eventType);

            if (!validationService.IsValid)
            {
                validationResult.AddError(eventType.ValidationResult);
                return(validationResult);
            }

            eventTypeRepository.Update(eventType);

            return(validationResult);
        }