public ActionResult Create([Bind(Include = "Volun_Id,VolunFname,VolunLname,VolunEmail,VolunDateofbirth,VolunStreetaddress," + "VolunStreetaddress2,VolunCity,VolunState,VolunZip,County,VolunAvailableMonday,VolunAvailableMondayMorning,VolunAvailableMondayAfternoon," + "VolunAvailableMondayEvening,VolunAvailableTuesday,VolunAvailableTuesdayMorning,VolunAvailableTuesdayAfternoon,VolunAvailableTuesdayEvening," + "VolunAvailableWednesday,VolunAvailableWednesdayMorning,VolunAvailableWednesdayAfternoon,VolunAvailableWednesdayEvening,VolunAvailableThursday," + "VolunAvailableThursdayMorning,VolunAvailableThursdayAfternoon,VolunAvailableThursdayEvening,VolunAvailableFriday,VolunAvailableFridayMorning," + "VolunAvailableFridayAfternoon,VolunAvailableFridayEvening,VolunAvailableSaturday,VolunAvailableSaturdayMorning,VolunAvailableSaturdayAfternoon," + "VolunAvailableSaturdayEvening,VolunAvailableSunday,VolunAvailableSundayMorning,VolunAvailableSundayAfternoon,VolunAvailableSundayEvening," + "VoluntNutrition,VolunTrainingFacilitator,VolunAdmin,VolunGeneral,VolunHealthyliving,VolunDiseaseManagement,VolunFallsPrevention,VolunCaregiver," + "VolunMentalWellness,VolunEvents,VolunSocialMedia,VolunOtherInterest")] tbl_Volunteer volunteer) { if (ModelState.IsValid) { volunteer.DateCreated = DateTime.Now; volunteer.IsApproved = "P"; db.tbl_Volunteer.Add(volunteer); db.SaveChanges(); //add the orderlines to the database after creating the order Basket basket = Basket.GetBasket(this.HttpContext); basket.CreateOrderLines(volunteer); db.SaveChanges(); return(RedirectToAction("Details", new { id = volunteer.Volun_Id })); } return(RedirectToAction("Review")); }
public ActionResult Create([Bind(Include = "Oppor_Id,Oppor_Name,Oppor_Description,Oppor_Dateofevent,Oppor_ImageThumbnailUrl," + "Oppor_ImageUrl,Oppor_Streetaddress,Oppor_Streetaddress2,Oppor_City,Oppor_State,Oppor_Zip,Oppor_County,Oppor_Eldersource," + "Oppor_Eldersourceinstitute,Oppor_RequiresBackgroundCheck,Oppor_IsFeatured,Oppor_CreatedOn," + "UserId,Role")] tbl_Opportunity opportunity, OpportunityViewModel opportunityVM) { if (ModelState.IsValid) { foreach (var item in db.OPPOR_HAS_CATEGORY) { if (item.Oppor_Id == opportunity.Oppor_Id) { db.Entry(item).State = System.Data.Entity.EntityState.Deleted; } } foreach (var item in opportunityVM.Categories) { if (item.Checked) { db.OPPOR_HAS_CATEGORY.Add(new OPPOR_HAS_CATEGORY() { Oppor_Id = opportunity.Oppor_Id, Category_Id = item.Id }); } } db.tbl_Opportunity.Add(opportunity); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(opportunity)); }
public ActionResult Edit([Bind(Include = "Volun_Id,VolunFname,VolunLname,VolunEmail,VolunDateofbirth,VolunStreetaddress,VolunStreetaddress2,VolunCity,VolunState,VolunZip,County,VolunAvailableMonday,VolunAvailableMondayMorning,VolunAvailableMondayAfternoon,VolunAvailableMondayEvening,VolunAvailableTuesday,VolunAvailableTuesdayMorning,VolunAvailableTuesdayAfternoon,VolunAvailableTuesdayEvening,VolunAvailableWednesday,VolunAvailableWednesdayMorning,VolunAvailableWednesdayAfternoon,VolunAvailableWednesdayEvening,VolunAvailableThursday,VolunAvailableThursdayMorning,VolunAvailableThursdayAfternoon,VolunAvailableThursdayEvening,VolunAvailableFriday,VolunAvailableFridayMorning,VolunAvailableFridayAfternoon,VolunAvailableFridayEvening,VolunAvailableSaturday,VolunAvailableSaturdayMorning,VolunAvailableSaturdayAfternoon,VolunAvailableSaturdayEvening,VolunAvailableSunday,VolunAvailableSundayMorning,VolunAvailableSundayAfternoon,VolunAvailableSundayEvening,VoluntNutrition,VolunTrainingFacilitator,VolunAdmin,VolunGeneral,VolunHealthyliving,VolunDiseaseManagement,VolunFallsPrevention,VolunCaregiver,VolunMentalWellness,VolunEvents,VolunSocialMedia,VolunOtherInterest,VolunBackgroundCheckRequired,VolunBackgroundCheckCompletedOn,VolunBackgroundCheckExpiresOn,VolunActivitiesParticipated,VolunMarkVolunteer,VolunFlagged,VolunFlaggedInformation,VolunGeneralNotes,VolunUpdateHours,DateCreated,Password,IsApproved")] tbl_Volunteer tbl_Volunteer) { if (ModelState.IsValid) { db.Entry(tbl_Volunteer).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(tbl_Volunteer)); }
public ActionResult Create([Bind(Include = "UserId,UserEmail,Password,Role")] tbl_User tbl_User) { if (ModelState.IsValid) { db.tbl_User.Add(tbl_User); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(tbl_User)); }
public ActionResult Create([Bind(Include = "Oppor_Id,Category_Id,Assigned")] OPPOR_HAS_CATEGORY oPPOR_HAS_CATEGORY) { if (ModelState.IsValid) { db.OPPOR_HAS_CATEGORY.Add(oPPOR_HAS_CATEGORY); db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.Category_Id = new SelectList(db.tbl_Category, "Category_Id", "CategoryName", oPPOR_HAS_CATEGORY.Category_Id); ViewBag.Oppor_Id = new SelectList(db.tbl_Opportunity, "Oppor_Id", "Oppor_Name", oPPOR_HAS_CATEGORY.Oppor_Id); return(View(oPPOR_HAS_CATEGORY)); }
public ActionResult Edit([Bind(Include = "Category_Id,CategoryName,CategoryDesc")] tbl_Category tbl_Category) { if (ModelState.IsValid) { db.Entry(tbl_Category).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(tbl_Category)); }
public void AddToBasket(Basket basket2, tbl_Opportunity opportunity) { var basketLine = db.BasketLines.FirstOrDefault(b => b.BasketID == BasketID && b.Oppor_Id == opportunity.Oppor_Id); if (basketLine == null) { basketLine = new BasketLine { Oppor_Id = opportunity.Oppor_Id, BasketID = BasketID, Quantity = 1, DateCreated = DateTime.Now }; db.BasketLines.Add(basketLine); } else { basketLine.Quantity++;/*= quantity;*/ } db.SaveChanges(); }
public void Save() { db.SaveChanges(); }