public ActionResult Get() { //return dbContext.Set<Users>().ToList(); StringBuilder response = new StringBuilder(); List <Users> users = dbContext.Set <Users>().ToList(); response.AppendLine("<table class=\"table\"> <thead class=\"thead-dark\"><tr><th scope=\"col\"> Name </th>" + "<th scope = \"col\" > Login </ th >" + "<th scope = \"col\" > Mail </ th >" + "<th scope = \"col\" > Phone </ th >" + "</tr >" + "</thead >" + "< tbody > "); foreach (var i in users) { response.AppendLine("<tr>< th scope = \"row\" >" + i.Name + "</ th >< td >" + i.Login + "</ td >< td >" + i.Email + "</ td >< td >" + i.Phone + "</ td ></ tr >"); //<tr>< th scope = "row" > 1 </ th >< td > Mark </ td >< td > Otto </ td > < td > @mdo </ td ></ tr > } response.AppendLine("</tbody></table>"); ViewData["table"] = response.ToString(); //Response.BodyWriter(response.ToString()) //Response.Write(response.ToString()); //ViewBag.Rd = rd; return(View()); }
public string Get() { //return JsonConvert.SerializeObject(dbContext.Set<Users>().Where(b => b.Login.Contains("maxim"))); return(JsonConvert.SerializeObject(dbContext.Set <Users>())); }