Exemple #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");
 }
Exemple #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");
        }
Exemple #3
0
 private Notification(NotificationType type, Gig gig)
 {
     Gig      = gig ?? throw new ArgumentNullException("gig");
     Type     = type;
     DateTime = DateTime.Now;
 }
Exemple #4
0
 public static Notification GigCanceled(Gig gig)
 {
     return(new Notification(NotificationType.GigCanceled, gig));
 }
Exemple #5
0
 public static Notification GigCreated(Gig gig)
 {
     return(new Notification(NotificationType.getCreated, gig));
 }
 public static Notification GigCreated(Gig gig)
 {
     return(new Notification(gig, NotificationType.GigCreated));
 }
Exemple #7
0
 private Notification(Gig gig, NotificationType notificationType)
 {
     Gig      = gig ?? throw new NullReferenceException("gig");
     Type     = notificationType;
     DateTime = DateTime.Now;
 }
Exemple #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);
        }
Exemple #9
0
 private Notification(Gig gig, NotificationType type)
 {
     Gig      = gig;
     DateTime = DateTime.Now;
     Type     = type;
 }
Exemple #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);
        }
Exemple #11
0
 private Notification(NotificationType notificationType, Gig gig)
 {
     Gig = gig ?? throw new ArgumentNullException(nameof(gig));
     NotificationType = notificationType;
     DateTime         = DateTime.Now;
 }
 public static Notification gigCancelled(Gig gig)
 {
     return(new Notification(gig, NotificationType.GigCancelled));
 }
 private Notification(Gig gig, NotificationType type)
 {
     this.DateTime = DateTime.Now;
     this.Gig      = gig ?? throw new ArgumentNullException("gig");
     this.Type     = type;
 }