public void AddMessageFromFormData(string content) { IDictionary <string, string> formDataVariables = VariablesExtractor.ExtractVariables(content); Message message = new Message() { MessageText = formDataVariables["message"], Sender = formDataVariables["email"], Subject = formDataVariables["subject"] }; this.context.Messages.Add(message); this.context.SaveChanges(); }
public IList <Knive> GetKnivesByNamesFromUrl(string url) { int variableSeparatorIndex = url.IndexOf('?'); if (variableSeparatorIndex != -1) { string queryString = url.Substring(variableSeparatorIndex + 1); IDictionary <string, string> variables = VariablesExtractor.ExtractVariables(queryString); var knifeName = variables["product-name"]; return(this.context.Knives.Where(knive => knive.Name.Contains(knifeName)).ToList()); } return(this.context.Knives.ToList()); }