コード例 #1
0
        public async Task <IActionResult> Create([Bind("Id,Nombre,Apellido,Estado,Cedula,Cola,Tiempo_Init")] Usuarios usuarios)
        {
            if (ModelState.IsValid)
            {
                _context.Add(usuarios);
                await _context.SaveChangesAsync();

                return(Redirect("/Usuarios/Edit/" + usuarios.Id));
            }

            return(View(usuarios));
        }
コード例 #2
0
        public async Task <IActionResult> Create(int tmp, [Bind("id, event_id, name, place, hour, user_mail, user_name, user_surname, event_type, NIP, tickets_per_person")] TicketsModel ticketsModel)
        {
            ViewBag.type           = ticketsModel.event_type;
            ticketsModel.user_mail = HttpContext.User.Identity.Name.ToString();
            if (ModelState.IsValid)
            {
                _context.Add(ticketsModel);
                await _context.SaveChangesAsync();

                return(RedirectToAction("AddTickets", "EventsModels", new { id = ticketsModel.event_id }));
            }
            return(View(ticketsModel));
        }