예제 #1
0
 public override bool Validate(int request)
 {
     if (_repository.Exists(request))
     {
         return(true);
     }
     Errors.Add(new ErrorDto("404", "Dashboard Component with such ID does not exist"));
     return(false);
 }
예제 #2
0
        public override bool Validate(DashboardComponentDto request)
        {
            var serializer = new JavaScriptSerializer();
            var data       = serializer.Deserialize <ComponentData>(request.Definition);

            if (request.Type == 3)
            {
                if (data.Dimensions.Any(dimension => dimension.Group.GroupName.ToLower() != "time"))//TODO GROUP MNEMONICS
                {
                    Errors.Add(new ErrorDto("EN", "Timeline component can only have dimensions with Time category"));
                }
            }

            if (_repository.Exists(request.Id))
            {
                return(true);
            }
            Errors.Add(new ErrorDto("404", "A Dashboard Component with such ID does not exist."));
            return(false);
        }