public override bool Validate(DashboardDto request) { if (!_repository.Exists(request.Id)) { Errors.Add(new ErrorDto("404", "A Dashboard with such ID does not exist")); } var componentRepository = new DashboardComponentRepository(); if (request.ComponentIds != null) { if (request.ComponentIds.Count > 0) { foreach (var component in request.ComponentIds) { if (componentRepository.Exists(component)) { continue; } Errors.Add(new ErrorDto("404", "A provided Dashboard Component with ID " + component + " does not exist")); } } } if (Errors.Count == 0) { return(true); } return(false); }
public override bool Validate(int request) { if (_repository.Exists(request)) { return(true); } return(false); }
public override bool Validate(int request) { if (_repository.Exists(request)) { return(true); } Errors.Add(new ErrorDto("404", "A Dashboard with such ID does not exist")); return(false); }