Пример #1
0
        public async Task <IActionResult> Create([Bind("StaffEntityId,Firstname,Lastname,Email")] StaffEntity staffEntity)
        {
            if (ModelState.IsValid)
            {
                _context.Add(staffEntity);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(staffEntity));
        }
Пример #2
0
        public async Task <IActionResult> Create([Bind("TicketId,Price,StaffEntityId")] Ticket ticket)
        {
            if (ModelState.IsValid)
            {
                _context.Add(ticket);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["StaffEntityId"] = new SelectList(_context.StaffEntities, "StaffEntityId", "Email", ticket.StaffEntityId);
            return(View(ticket));
        }