コード例 #1
0
 public static bool DeleteBusLineView(IQueryBuilder <BusLineView> iquery)
 {
     using (var entity = new BusEntities())
     {
         var obj = entity.BusLineView.FirstOrDefault(iquery.Expression);
         entity.DeleteObject(obj);
         return(entity.SaveChanges() > 0);
     }
 }
コード例 #2
0
 public static bool DeletePayMent(int ID)
 {
     using (var entity = new BusEntities())
     {
         var obj = entity.PayMent.FirstOrDefault(x => x.ID == ID);
         entity.DeleteObject(obj);
         return(entity.SaveChanges() > 0);
     }
 }
コード例 #3
0
 public static bool DeleteQuestionItem2(IQueryBuilder <QuestionItem2> iquery)
 {
     using (var entity = new BusEntities())
     {
         var obj = entity.QuestionItem2.FirstOrDefault(iquery.Expression);
         entity.DeleteObject(obj);
         return(entity.SaveChanges() > 0);
     }
 }
コード例 #4
0
 public static bool DeleteManagerLine(int ManagerID, int LineID)
 {
     using (var entity = new BusEntities())
     {
         var obj = entity.ManagerLine.FirstOrDefault(x => x.ManagerID == ManagerID && x.LineID == LineID);
         entity.DeleteObject(obj);
         return(entity.SaveChanges() > 0);
     }
 }
コード例 #5
0
 public static bool DeleteMyContent(IQueryBuilder <MyContent> iquery)
 {
     using (var entity = new BusEntities())
     {
         var obj = entity.MyContent.FirstOrDefault(iquery.Expression);
         entity.DeleteObject(obj);
         return(entity.SaveChanges() > 0);
     }
 }
コード例 #6
0
 public static bool DeleteBusLineView(int[] ids)
 {
     using (var entity = new BusEntities())
     {
         foreach (var id in ids)
         {
             var obj = entity.BusLineView.FirstOrDefault(x => x.ID == id);
             entity.DeleteObject(obj);
         }
         return(entity.SaveChanges() > 0);
     }
 }
コード例 #7
0
        public static bool DeleteAddressByParentID(IQueryBuilder <Address> iquery)
        {
            using (var entity = new BusEntities())
            {
                List <Address> addressList = entity.Address.Where(iquery.Expression).ToList();

                if (addressList.Count != 0)
                {
                    foreach (var address in addressList)
                    {
                        entity.DeleteObject(address);
                    }

                    return(entity.SaveChanges() > 0);
                }
                else
                {
                    return(true);
                }
            }
        }