public async Task <IActionResult> Create([Bind("ID,Name,Type,Location,Available")] Resource resource) { if (ModelState.IsValid) { resource.ID = Guid.NewGuid(); _context.Add(resource); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(resource)); }
public async Task <IActionResult> Create([Bind("Id,Active,ExpirationDate")] Subscription subscription) { if (ModelState.IsValid) { subscription.Id = Guid.NewGuid(); _context.Add(subscription); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(subscription)); }
public async Task <IActionResult> Create([Bind("ID,Amount,ServiceType")] Invoice invoice) { if (ModelState.IsValid) { invoice.ID = Guid.NewGuid(); _context.Add(invoice); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(invoice)); }
public async Task <IActionResult> Create([Bind("Id")] Attendee attendee) { if (ModelState.IsValid) { attendee.Id = Guid.NewGuid(); _context.Add(attendee); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(attendee)); }
public async Task <IActionResult> Create([Bind("ID,Date,Amount")] Payment payment) { if (ModelState.IsValid) { payment.ID = Guid.NewGuid(); _context.Add(payment); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(payment)); }
public async Task <IActionResult> Create([Bind("ID")] Booking booking) { if (ModelState.IsValid) { booking.ID = Guid.NewGuid(); _context.Add(booking); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(booking)); }
public async Task <IActionResult> Create([Bind("ID,Name,Description,StartDate,EndDate")] Event @event) { if (ModelState.IsValid) { @event.ID = Guid.NewGuid(); _context.Add(@event); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(@event)); }