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)); }
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); }
protected override void Seed(VMSContext context) { GenerateGender(context); GenerateRoles(context); GenerateCardType(context); GenerateSystemAdmin(context); GenerateEmailFormat(context); context.SaveChanges(); }
/// <summary> /// Commits the unit of work /// </summary> public void Commit() { _DataContext.SaveChanges(); }