private void SaveChange()
 {
     using (var context = new StockShopEntities())
     {
         context.SaveChanges();
     }
 }
 public void DeleteEntity(int id)
 {
     using (var context = new StockShopEntities())
     {
         context.Income.Remove(context.Income.Find(id));
         SaveChange();
     }
 }
 public Income GetEntity(int id)
 {
     using (var context = new StockShopEntities())
     {
         var entity = context.Income.Find(id);
         return(entity);
     }
 }
示例#4
0
 public Category GetEntity(int id)
 {
     using (var context = new StockShopEntities())
     {
         var entity = context.Category.Find(id);
         return(entity);
     }
 }
示例#5
0
 public Employee GetEntity(int id)
 {
     using (var context = new StockShopEntities())
     {
         var entity = context.Employee.Find(id);
         return(entity);
     }
 }
示例#6
0
 public Position GetEntity(int id)
 {
     using (var context = new StockShopEntities())
     {
         var entity = context.Position.Find(id);
         return(entity);
     }
 }
 public Product GetEntity(int id)
 {
     using (var context = new StockShopEntities())
     {
         var entity = context.Product.Find(id);
         return(entity);
     }
 }
 public void CreateEntity(Outcome entity)
 {
     if (entity == null)
     {
         throw new ArgumentNullException("entity");
     }
     using (var context = new StockShopEntities())
     {
         context.Outcome.Add(entity);
         context.SaveChanges();
     }
 }