コード例 #1
0
        public IActionResult OnGet(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            var gig = _unityOfWork.Gigs.GetGig(id);

            if (gig == null)
            {
                return(NotFound());
            }

            if (gig.ArtistId != _userManager.GetUserId(this.User))
            {
                return(new UnauthorizedResult());
            }

            Input = new InputModelGig()
            {
                Id     = gig.Id,
                Date   = gig.DateTime.ToString("yyyy-MM-dd"),
                Time   = gig.DateTime.ToString("HH:mm"),
                Venue  = gig.Venue,
                Genre  = gig.GenreId,
                Genres = _unityOfWork.Genres.GetGenres()
            };

            return(Page());
        }
コード例 #2
0
 public GigDetailsModel(IUnityOfWork unityOfWork, UserManager <ApplicationUser> userManager,
                        SignInManager <ApplicationUser> signInManager)
 {
     _userManager   = userManager;
     _signInManager = signInManager;
     _unityOfWork   = unityOfWork;
     Input          = new InputModelGig();
 }