public async Task <IActionResult> Create([Bind("UserId,Name,LastName,Email")] User user)
        {
            if (ModelState.IsValid)
            {
                _context.Add(user);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(user));
        }
Beispiel #2
0
        public async Task <IActionResult> Create([Bind("BuildingId,Name,Address")] Building building)
        {
            if (ModelState.IsValid)
            {
                _context.Add(building);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(building));
        }
Beispiel #3
0
        public async Task <IActionResult> Create([Bind("VehicleId,Mark,ModelType,СarryingСapacity,YearIssue,UsefulVolume,VehicleType,OverallDimensions")] Vehicle vehicle)
        {
            if (ModelState.IsValid)
            {
                _context.Add(vehicle);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(vehicle));
        }
        public async Task <IActionResult> Create([Bind("Id,Registedtime,InOut,UserId,BuildingId")] Registry registry)
        {
            if (ModelState.IsValid)
            {
                _context.Add(registry);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["BuildingId"] = new SelectList(_context.Buildings, "BuildingId", "BuildingId", registry.BuildingId);
            ViewData["UserId"]     = new SelectList(_context.Users, "UserId", "UserId", registry.UserId);
            return(View(registry));
        }