예제 #1
0
        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));
        }
예제 #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));
        }
예제 #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));
        }