public ActionResult DisplayAvailableMusicForLoggedUser() { var identityKey = User.Identity.GetUserId(); int userId = _userAccountService.ConvertGuidInStringIdToIntId(identityKey); ViewBag.AvailableMusicList = _musicStoreDisplayService.DisplayAllAvailableSongs(userId); ViewBag.userId = userId; return(View()); }
public ActionResult DisplayUserStatistic() { try { string identityKey = User.Identity.GetUserId(); int userId = _userAccountService.ConvertGuidInStringIdToIntId(identityKey); decimal totalSpentMoney = _userStatisticService.GetTotalSpentMoney(userId); int totalBoughtSongAmount = _userStatisticService.GetTotalNumberOfSongs(userId); var userStatisticViewModel = new UserStatisticViewModel(totalBoughtSongAmount, totalSpentMoney); return(View(userStatisticViewModel)); } catch (ArgumentException exception) { var innerExcept = exception.InnerException != null ? exception.InnerException.Message : " "; return(new HttpStatusCodeResult(HttpStatusCode.BadRequest, $"{innerExcept} and {exception.Message}")); } catch (Exception exception) { var innerExcept = exception.InnerException != null ? exception.InnerException.Message : " "; return(new HttpStatusCodeResult(HttpStatusCode.InternalServerError, $"{innerExcept} and {exception.Message}")); } }