//這個方法用來修改
        public static void ModifiedPeriod(int applyId, string morning, string afternoon, string night, string assistance, int totalPeople)
        {
            VolunteerEntities           db = new VolunteerEntities();
            List <Apply_Service_period> apply_Service_Periods = db.Apply_Service_period.Where(a => a.Apply_ID == applyId).ToList();

            foreach (var item in apply_Service_Periods)
            {
                db.Apply_Service_period.Remove(item);
            }//傳applyId近來先全部刪除 再全部新增

            Manpower_apply apply_Service_Period = db.Manpower_apply.Find(applyId);

            ////這邊寫一個foreach計算該applyId的人數
            //int totalPeople = 0;
            //List<int>temp= db.Apply_Service_period.Where(a => a.Apply_ID == applyId).Select(a => a.Volunteer_number.Value).ToList();
            //foreach (var item in temp)
            //{
            //    totalPeople += item;
            //}
            apply_Service_Period.Application_number = totalPeople;
            db.Entry(apply_Service_Period).State    = System.Data.Entity.EntityState.Modified;

            db.SaveChanges();
            ConvertAndInsert(applyId, morning, afternoon, night, assistance);
        }
 public void Update(T _entity)
 {
     dbContext.Entry(_entity).State = EntityState.Modified;
     dbContext.SaveChanges();
 }