// GET: Measurements public IActionResult Index(string sortby) { var measurements = _measurementRepo.GetAll().Where(m => m.UserID.Equals(_userManager.GetUserId(HttpContext.User))); ViewBag.OrderByDate = string.IsNullOrEmpty(sortby)? "date_asc" : ""; switch (sortby) { case "date_asc": measurements = measurements.OrderBy(x => x.Date).ToList(); break; default: measurements = measurements.OrderByDescending(x => x.Date).ToList(); break; } return(View(measurements)); }
public List <Measurement> GetMeasurements() { return(measurementRepo.GetAll().ToList()); }