Exemple #1
0
        public ActionResult Edit(int id)
        {
            var gigToEdit = _gigRepository.GetSingleGig(id);

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

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

            var viewModel = new GigFormViewModel
            {
                Id      = gigToEdit.Id,
                Genres  = _genreRepository.GetAllGenres(),
                Date    = gigToEdit.DateTime.ToString("dd.MM.yyyy"),
                Time    = gigToEdit.DateTime.ToString("HH:mm"),
                Venue   = gigToEdit.Venue,
                Genre   = gigToEdit.GenreId,
                Heading = "Edit a Gig"
            };

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