Пример #1
0
        public ActionResult Edit(int id)
        {
            string userId = User.Identity.GetUserId();

            Gig gig = gigRepository.GetGig(id);

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

            if (User.Identity.GetUserId() != gig.ArtistId)
            {
                return(new HttpUnauthorizedResult());
            }

            GigFormViewModel model = new GigFormViewModel();

            model.Genres  = genreRepository.GetAllGenres();
            model.Date    = gig.DateTime.ToString("d MMM yyyy");
            model.Time    = gig.DateTime.ToString("HH: mm");
            model.Genre   = gig.GenreId;
            model.Venue   = gig.Venue;
            model.Id      = id;
            model.Heading = "Edit Gig";

            return(View("GigForm", model));
        }