예제 #1
0
        public ActionResult Update(GigFormViewModel model)
        {
            if (ModelState.IsValid)
            {
                Gig gig = gigRepository.GetGigWithAttendees(model.Id);

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

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

                gig.Modify(model, gig);

                gigRepository.UpdateGig(gig);

                return(RedirectToAction("Mine", "Gigs"));
            }
            else
            {
                model.Genres = genreRepository.GetAllGenres();
                return(View("GigForm", model));
            }
        }