Пример #1
0
        public ActionResult Create([Bind(Include = "VolunteerId,FirstName,LastName,Username,Password,Address,PhoneNumber,EmailAddress,EmergencyContact,DriversLicenseOnFile,SSCardOnFile,EducationId")] Volunteer volunteer)
        {
            if (ModelState.IsValid)
            {
                db.Volunteers.Add(volunteer);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.EducationId = new SelectList(db.Educations, "EducationId", "EducationLevel", volunteer.Education.EducationId);
            return(View(volunteer));
        }
Пример #2
0
        public bool AddVehicle(Vehicle newVehicle)
        {
            dbContext.Vehicle.Add(newVehicle);
            dbContext.SaveChanges();

            var attributeValues = newVehicle.AttributeValues.Select(q => {
                q.VehicleId = newVehicle.Id;
                return(q);
            });


            dbContext.AttributeValue.AddRange(attributeValues);
            dbContext.SaveChanges();
            return(true);
        }
Пример #3
0
 protected override void Seed(VMSContext context)
 {
     GenerateGender(context);
     GenerateRoles(context);
     GenerateCardType(context);
     GenerateSystemAdmin(context);
     GenerateEmailFormat(context);
     context.SaveChanges();
 }
Пример #4
0
 /// <summary>
 /// Commits the unit of work
 /// </summary>
 public void Commit()
 {
     _DataContext.SaveChanges();
 }