public HttpResponseMessage Save([FromBody] bec_AssInformation entity)
 {
     return(ExceptionHelp.Execute <bool>(() =>
     {
         return dbBase.Save(entity);
     }, Request));
 }
 public HttpResponseMessage Get(int id)
 {
     return(ExceptionHelp.Execute <bec_AssInformation>(() =>
     {
         return dbBase.Find(id);
     }, Request));
 }
        public HttpResponseMessage Delete(int id)
        {
            bec_AssInformation entity = new bec_AssInformation {
                Id = id
            };

            return(ExceptionHelp.Execute <bool>(() =>
            {
                return dbBase.Delete(entity);
            }, Request));
        }
        public HttpResponseMessage Search(string searchText, int pageIndex, int pageSize)
        {
            Expression <Func <bec_AssInformation, bool> > queryexpress = CreateLinkQuery(searchText);
            Expression <Func <bec_AssInformation, int> >  orderexpress = p => p.Id;
            int total = 0;

            return(ExceptionHelp.Execute <PagingEntity <bec_AssInformation> >(() =>
            {
                PagingEntity <bec_AssInformation> result = new PagingEntity <bec_AssInformation>();
                result.items = dbBase.LoadPagerEntities(pageSize, pageIndex, out total, queryexpress, true, orderexpress);
                result.total = total;
                return result;
            }, Request));
        }
        public HttpResponseMessage ListPage([FromBody] bec_AssInformation filter, int pageIndex, int pageSize)
        {
            Expression <Func <bec_AssInformation, bool> > queryexpress = CreateQueryFilter(filter);
            Expression <Func <bec_AssInformation, int> >  orderexpress = p => p.Id;
            int total = 0;

            return(ExceptionHelp.Execute <PagingEntity <bec_AssInformation> >(() =>
            {
                PagingEntity <bec_AssInformation> result = new PagingEntity <bec_AssInformation>();
                result.items = dbBase.LoadPagerEntities(pageSize, pageIndex, out total, queryexpress, true, orderexpress);
                result.total = total;
                return result;
            }, Request));
        }
 public HttpResponseMessage Update([FromBody] bec_AssInformation entity)
 {
     return(ExceptionHelp.Execute <bool>(() =>
     {
         BeckManEntities dbContext = new BeckManEntities();
         bec_AssInformation dbEntity = dbContext.bec_AssInformationSet.Find(entity.Id);
         if (entity.bec_Aear != null)
         {
             bec_Aear aear = dbContext.bec_AearSet.Find(entity.bec_Aear.Id);
             aear.bec_AssInformation.Add(dbEntity);
         }
         if (entity.bec_Partion != null)
         {
             bec_Partion partion = dbContext.bec_PartionSet.Find(entity.bec_Partion.Id);
             partion.bec_AssInformation.Add(dbEntity);
         }
         dbContext.SaveChanges();
         return dbBase.Update(entity);
     }, Request));
 }