public static OptionsArray operator +(OptionsArray a, OptionsArray b) { var rtn = new OptionsArray { _GuiLayout = new List <GUILayoutOption>(a._GuiLayout.Count + b._GuiLayout.Count) }; rtn._GuiLayout.AddRange(a._GuiLayout); rtn._GuiLayout.AddRange(b._GuiLayout); return(rtn); }
public string GetOptions(Char[] input) { Stopwatch s = Stopwatch.StartNew(); string inputArray = new string(input.OrderBy(p => p).ToArray()); OptionsArrayJsonModel model = new OptionsArrayJsonModel() { IsError = false }; OptionsArray optionArray; //проверим входящие данные var(isError, errorMessage) = validator.Validate(input); if (isError) { model.IsError = isError; model.ErrorMessage = errorMessage; s.Stop(); model.WorkTime = s.Elapsed.ToString(); optionArray = new OptionsArray { Keyword = inputArray, OptionsList = jsonResult.GetJsonResult(model) }; return(jsonResult.GetJsonResult(model)); } //проверим встречался ли нам такой случай if (repository.AnyByKeyword(inputArray)) { var item = repository.GetByKeyword(inputArray); return(item.OptionsList); } model.Options = optionResult.GeOptionsSortArray(inputArray); s.Stop(); model.WorkTime = s.Elapsed.ToString(); optionArray = new OptionsArray { Keyword = inputArray, OptionsList = jsonResult.GetJsonResult(model) }; repository.Insert(optionArray); return(optionArray.OptionsList); }
public void Insert(OptionsArray optionsArray) { db.OptionsArrays.Add(optionsArray); db.SaveChanges(); }