예제 #1
0
 public Annal Get(Expression <Func <Annal, bool> > filter)
 {
     using (AnnalContext context = new AnnalContext(_tenantResolver))
     {
         return(context.Set <Annal>().SingleOrDefault(filter));
     }
 }
예제 #2
0
 public void Delete(Annal entity)
 {
     using (AnnalContext context = new AnnalContext(_tenantResolver))
     {
         var deletedEntity = context.Entry(entity);
         deletedEntity.State = EntityState.Deleted;
         context.SaveChanges();
     }
 }
예제 #3
0
 public void Update(Annal entity)
 {
     using (AnnalContext context = new AnnalContext(_tenantResolver))
     {
         var updatedEntity = context.Entry(entity);
         updatedEntity.State = EntityState.Modified;
         context.SaveChanges();
     }
 }
예제 #4
0
 public void Add(Annal entity)
 {
     using (AnnalContext context = new AnnalContext(_tenantResolver))
     {
         var addedEntity = context.Entry(entity);
         addedEntity.State = EntityState.Added;
         context.SaveChanges();
     }
 }
예제 #5
0
 public List <Annal> GetAll(Expression <Func <Annal, bool> > filter = null)
 {
     using (AnnalContext context = new AnnalContext(_tenantResolver))
     {
         return(filter == null
             ? context.Set <Annal>().ToList()
             : context.Set <Annal>().Where(filter).ToList());
     }
 }