예제 #1
0
 public ActionResult Create(GigFormViewModel viewModel)
 {
     var gig = new Gig()
     {
         ArtistId = User.Identity.GetUserId(),
         DateTime = viewModel.DateTime,
         GenreId = viewModel.Genre,
         Venue = viewModel.Venue
     };
     _context.Gig.Add(gig);
     _context.SaveChanges();
     return RedirectToAction("Index", "Home");
 }
예제 #2
0
        public ActionResult Create(GigFormViewModel viewModel)
        {
            if (!ModelState.IsValid)
            {
                viewModel.Genres = _context.Genres.ToList();
                return View("GigForm", viewModel);
            }

            var gig = new Gig()
            {
                ArtistId = User.Identity.GetUserId(),
                DateTime = viewModel.GetDateTime(),
                GenreId = viewModel.Genre,
                Venue = viewModel.Venue
            };
            _context.Gigs.Add(gig);
            _context.SaveChanges();

            return RedirectToAction("Mine", "Gigs");
        }
예제 #3
0
 private Notification(NotificationType type, Gig gig)
 {
     Gig      = gig ?? throw new ArgumentNullException("gig");
     Type     = type;
     DateTime = DateTime.Now;
 }
예제 #4
0
 public static Notification GigCanceled(Gig gig)
 {
     return(new Notification(NotificationType.GigCanceled, gig));
 }
예제 #5
0
 public static Notification GigCreated(Gig gig)
 {
     return(new Notification(NotificationType.getCreated, gig));
 }
예제 #6
0
 public static Notification GigCreated(Gig gig)
 {
     return(new Notification(gig, NotificationType.GigCreated));
 }
예제 #7
0
 private Notification(Gig gig, NotificationType notificationType)
 {
     Gig      = gig ?? throw new NullReferenceException("gig");
     Type     = notificationType;
     DateTime = DateTime.Now;
 }
예제 #8
0
        public static Notification GigUpdated(DateTime originalDateTime, string originalVenue, Gig newGig)
        {
            var notification = new Notification(newGig, NotificationType.GigUpdated);

            notification.OriginalDateTime = originalDateTime;
            notification.OriginalVenue    = originalVenue;

            return(notification);
        }
예제 #9
0
 private Notification(Gig gig, NotificationType type)
 {
     Gig      = gig;
     DateTime = DateTime.Now;
     Type     = type;
 }
예제 #10
0
        public static Notification GigUpdated(string originalVenue, DateTime originalDateTime, Gig updatedGig)
        {
            var result = new Notification(NotificationType.GigCanceled, updatedGig);

            result.OriginalVenue    = originalVenue;
            result.OriginalDateTime = originalDateTime;

            return(result);
        }
예제 #11
0
 private Notification(NotificationType notificationType, Gig gig)
 {
     Gig = gig ?? throw new ArgumentNullException(nameof(gig));
     NotificationType = notificationType;
     DateTime         = DateTime.Now;
 }
예제 #12
0
 public static Notification gigCancelled(Gig gig)
 {
     return(new Notification(gig, NotificationType.GigCancelled));
 }
예제 #13
0
 private Notification(Gig gig, NotificationType type)
 {
     this.DateTime = DateTime.Now;
     this.Gig      = gig ?? throw new ArgumentNullException("gig");
     this.Type     = type;
 }