public IActionResult GetLoremComma() { LoremTextComma loremText = new LoremTextComma(); string result; int maxId = db.LoremTextComma.Max(x => x.NumberOfWords); StringBuilder builder = new StringBuilder(); for (int i = 1; i <= maxId; i++) { loremText = db.LoremTextComma.Where(x => x.NumberOfWords == i).SingleOrDefault(); if (i == maxId) { builder.Append(loremText.LoremComma); } else { builder.Append(loremText.LoremComma).Append(","); } } result = builder.ToString(); return(Content(result)); }
public HttpResponseMessage GetLoremComma() { LoremTextComma loremText = new LoremTextComma(); var resp = new HttpResponseMessage(HttpStatusCode.OK); string result; int maxId = db.LoremTextComma.Max(x => x.numberOfWords); StringBuilder builder = new StringBuilder(); for (int i = 1; i <= maxId; i++) { loremText = db.LoremTextComma.Where(x => x.numberOfWords == i).SingleOrDefault(); if (i == maxId) { builder.Append(loremText.LoremComma); } else { builder.Append(loremText.LoremComma).Append(","); } } result = builder.ToString(); resp.Content = new StringContent(result, Encoding.UTF8, "text/plain"); return(resp); }