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"); }
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"); }
private Notification(NotificationType type, Gig gig) { Gig = gig ?? throw new ArgumentNullException("gig"); Type = type; DateTime = DateTime.Now; }
public static Notification GigCanceled(Gig gig) { return(new Notification(NotificationType.GigCanceled, gig)); }
public static Notification GigCreated(Gig gig) { return(new Notification(NotificationType.getCreated, gig)); }
public static Notification GigCreated(Gig gig) { return(new Notification(gig, NotificationType.GigCreated)); }
private Notification(Gig gig, NotificationType notificationType) { Gig = gig ?? throw new NullReferenceException("gig"); Type = notificationType; DateTime = DateTime.Now; }
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); }
private Notification(Gig gig, NotificationType type) { Gig = gig; DateTime = DateTime.Now; Type = type; }
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); }
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; }