コード例 #1
0
        public void Delete(int Id)
        {
            tbl_Volunteer volunteer = db.tbl_Volunteer.Find(Id);

            db.tbl_Volunteer.Remove(volunteer);
            Save();
        }
コード例 #2
0
        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"));
        }
コード例 #3
0
        public int CreateOrderLines(tbl_Volunteer volunteer)
        {
            var basketLines = GetBasketLines();

            foreach (var item in basketLines)
            {
                OrderLine orderLine = new OrderLine
                {
                    tbl_Opportunity = item.tbl_Opportunity,
                    Oppor_Id        = item.Oppor_Id,
                    Oppor_Name      = item.tbl_Opportunity.Oppor_Name,
                    Quantity        = item.Quantity,
                    DateCreated     = item.DateCreated,
                    Volun_Id        = volunteer.Volun_Id
                };


                db.OrderLines.Add(orderLine);
            }

            db.SaveChanges();
            EmptyBasket();

            return(volunteer.Volun_Id);
        }
コード例 #4
0
        public ActionResult DeleteConfirmed(int id)
        {
            tbl_Volunteer tbl_Volunteer = db.tbl_Volunteer.Find(id);

            db.tbl_Volunteer.Remove(tbl_Volunteer);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
コード例 #5
0
 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));
 }
コード例 #6
0
        // GET: Common/Volunteer/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            tbl_Volunteer tbl_Volunteer = db.tbl_Volunteer.Find(id);

            if (tbl_Volunteer == null)
            {
                return(HttpNotFound());
            }
            return(View(tbl_Volunteer));
        }
コード例 #7
0
        // GET: Common/Volunteer/Delete/5
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            tbl_Volunteer tbl_Volunteer = db.tbl_Volunteer.Include(o => o.OrderLines).Where(o => o.Volun_Id == id).SingleOrDefault();

            if (tbl_Volunteer == null)
            {
                return(HttpNotFound());
            }
            return(View(tbl_Volunteer));
        }
コード例 #8
0
        public ActionResult Review()
        {
            Basket        basket    = Basket.GetBasket(this.HttpContext);
            tbl_Volunteer volunteer = new tbl_Volunteer();

            volunteer.OrderLines = new List <OrderLine>();
            foreach (var basketLine in basket.GetBasketLines())
            {
                OrderLine line = new OrderLine
                {
                    tbl_Opportunity = basketLine.tbl_Opportunity,
                    Oppor_Id        = basketLine.Oppor_Id,
                    Oppor_Name      = basketLine.tbl_Opportunity.Oppor_Name,
                    Quantity        = basketLine.Quantity,
                    DateCreated     = basketLine.DateCreated
                };
                volunteer.OrderLines.Add(line);
            }

            return(View(volunteer));
        }
コード例 #9
0
 public void Update(tbl_Volunteer volunteer)
 {
     db.Entry(volunteer).State = EntityState.Modified;
 }
コード例 #10
0
 public void Insert(tbl_Volunteer volunteer)
 {
     db.tbl_Volunteer.Add(volunteer);
     Save();
 }
コード例 #11
0
 public void Update(tbl_Volunteer user)
 {
     objDb.Update(user);
     objDb.Save();
 }
コード例 #12
0
 public void Insert(tbl_Volunteer user)
 {
     objDb.Insert(user);
 }