public HttpResponseMessage Save([FromBody] bec_AssInformation entity) { return(ExceptionHelp.Execute <bool>(() => { return dbBase.Save(entity); }, Request)); }
private Expression <Func <bec_AssInformation, bool> > CreateQueryFilter(bec_AssInformation filter) { Expression <Func <bec_AssInformation, bool> > queryexpress = q => true; if (!string.IsNullOrEmpty(filter.DisName)) { queryexpress = queryexpress.And(p => p.DisName.Contains(filter.DisName)); } if (!string.IsNullOrEmpty(filter.DisNo)) { queryexpress = queryexpress.And(p => p.DisNo.Contains(filter.DisNo)); } if (!string.IsNullOrEmpty(filter.Year)) { queryexpress = queryexpress.And(p => p.Year.Equals(filter.Year)); } if (filter.bec_Partion != null) { queryexpress = queryexpress.And(p => p.bec_Partion.Id == filter.bec_Partion.Id); } if (filter.bec_Aear != null) { queryexpress = queryexpress.And(p => p.bec_Aear.Id == filter.bec_Aear.Id); } return(queryexpress); }
public HttpResponseMessage Delete(int id) { bec_AssInformation entity = new bec_AssInformation { Id = id }; return(ExceptionHelp.Execute <bool>(() => { return dbBase.Delete(entity); }, 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)); }