public async Task <HistoryServiceModel> GetHistoryForMovieAboutUser(string userId, Guid movieId) { History history = await this.Db.Histories .SingleOrDefaultAsync(x => x.CustomerId == userId && x.MovieId == movieId); HistoryServiceModel historyModel = new HistoryServiceModel(); if (history != null) { historyModel.Id = history.Id; historyModel.MovieName = history.Movie.Name; historyModel.CustomerName = history.Customer.UserName; historyModel.Price = history.Price; historyModel.Date = history.Date; } return(historyModel); }
public async Task <IActionResult> History(HistoryServiceModel model) { List <HistoryServiceModel> histories = await this.historyService.GetHistory(); return(View(histories)); }