public QuoteRecord Post([FromBody] QuoteRec submittedQuote) { System.Diagnostics.Debug.WriteLine(submittedQuote.ToString()); QuoteRecord qr = new QuoteRecord { Author = submittedQuote.Author, Quote = submittedQuote.Quote }; AddQuote(qr); return qr ; }
private static void AddQuote( QuoteRecord qr) { string NewQuote = qr.Quote + "--" + qr.Author; // WIP lock this access from multiple users var app = HttpContext.Current.Application; List<string> Quotes = (List<string>)app["AppQuotes"]; Quotes.Add(NewQuote); app["AppQuotes"] = Quotes; string QuoteFile = HttpContext.Current.Server.MapPath("~/App_Data/sig.dat"); // WIP save the file }
public static QuoteRecord BuildQuote(string q) { string[] data = q.Split(new string[] { "--" }, StringSplitOptions.RemoveEmptyEntries); string quote = data[0]; string author = ""; if (data.Length > 1) { author = data[1]; } QuoteRecord qr = new QuoteRecord { Author = author, Quote = quote }; return qr; }