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));
        }
Esempio n. 2
0
        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));
        }
Esempio n. 5
0
        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));
        }
Esempio n. 6
0
        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));
        }
Esempio n. 7
0
        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));
        }