示例#1
0
        public async Task <IActionResult> Create([Bind("ID,FirstName,LastName,Username,Password,Address,PhoneNumber,Email,EmergencyName,EmergencyPhone,EmergencyEmail,EmergencyAddress,DLCopyExists,SSCopyExists,Approved")] Volunteer volunteer)
        {
            if (ModelState.IsValid)
            {
                _context.Add(volunteer);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(volunteer));
        }
示例#2
0
        public async Task<int> AddAsync(Vehicle vehicle)
        {
            var newVehicle = new Entities.Vehicle
            {
                Mileage = vehicle.Mileage,
                Speed = vehicle.Speed,
                CreatedDttm = DateTime.Now,
                Type = (int)vehicle.VehicleType
            };

            context.Add(newVehicle);
            await context.SaveChangesAsync();
            return newVehicle.Id;
        }