public ActionResult Lend() { using (var dbContext = new MvclibraryEntities()) { var lends = dbContext.Lend.Where(l => l.State == "Odebrano").ToList(); var lendServicew = new LendService(); var lendViewModel = lendServicew.GetViewModel(lends.OrderBy(o => o.DateBorrowed).ToList()); return(View("Index", lendViewModel)); } }
// GET: Lend public ActionResult Index() { using (var dbContext = new MvclibraryEntities()) { var lends = dbContext.Lend.ToList(); var lendServicew = new LendService(); var lendViewModel = lendServicew.GetViewModel(lends.OrderBy(o => o.DateBorrowed).ToList()); return(View(lendViewModel)); } }
public ActionResult UserLEnd() { using (var dbContext = new MvclibraryEntities()) { var userEmail = User.Identity.Name; var user = dbContext.User.Where(u => u.Email == userEmail).FirstOrDefault(); var lends = dbContext.Lend.Where(l => l.UserId == user.Id).ToList(); var lendServicew = new LendService(); var lendViewModel = lendServicew.GetViewModel(lends.OrderBy(o => o.DateBorrowed).ToList()); return(View(lendViewModel)); } }