private bool CheckAllArgumentValues(Dictionary<string,string> arguments, InsetModel model)
        {
            foreach (var argument in arguments)
            {

                var argModel = model.Arguments.FirstOrDefault(x => x.Name == argument.Key);

                if (argModel != null)
                {
                    if (!_argumentValidator.IsValid(argModel.Type, argument.Value))
                    {
                        return false;
                    }
                }
            }
            return true;
        }
Example #2
0
 public InsetModel GetByName(string name)
 {
     InsetModel insetModel = null;
     using (var unitOfWork = _unitOfWorkFactory.Create())
     {
         try
         {
             var entity = unitOfWork.InsetRepository.Get(x=>x.Name==name).FirstOrDefault();
             if (entity != null)
             {
                 insetModel = new InsetModel(entity);
             }
             unitOfWork.Save();
         }
         catch (Exception e)
         {
             _logger.LogToFile(_logger.CreateErrorMessage(e));
         }
     }
     return insetModel;
 }
        private bool ContainsAllRequired(Dictionary<string,string> arguments, InsetModel model)
        {
            foreach (var argument in model.Arguments)
            {
                if (argument.IsRequierd)
                {
                    var temp = arguments.Where(x => x.Key ==argument.Name);
                    if (!temp.Any())
                    {
                        return false;
                    }
                }

            }
            return true;
            //return model.Arguments.Where(argument => argument.IsRequierd).All(argument => arguments.Contains(argument.Name));
        }