public ActionResult Location() { UsersStoreContext context = HttpContext.RequestServices.GetService(typeof(ProiectTW.Models.UsersStoreContext)) as UsersStoreContext; list = context.GetAllUsersLocations(2); string markers = "["; foreach (Locations item in list) { markers += "{"; markers += string.Format("'title': '{0}',", item.CityName); markers += string.Format("'lat': '{0}',", item.Latitude); markers += string.Format("'lng': '{0}',", item.Longitude); markers += string.Format("'description': '{0}'", item.Description); markers += "},"; } markers += "];"; ViewBag.Markers = markers; return(View()); }
// GET: /<controller>/ public IActionResult Index() { UsersStoreContext context = HttpContext.RequestServices.GetService(typeof(ProiectTW.Models.UsersStoreContext)) as UsersStoreContext; return(View(context.GetAllUsers())); }
public UsersRepository(UsersStoreContext context) { this._context = context; }