예제 #1
0
        public T Add(T entity)
        {
            _dbContext.Set <T>().Add(entity);
            _dbContext.SaveChanges();

            return(entity);
        }
예제 #2
0
 public void SetIsSupplierRateAssigned(int supplierId, bool isRateAssignedOrNot)
 {
     try
     {
         var model = new Supplier()
         {
             Id = supplierId,
             IsRateAssignedToSupplier = !isRateAssignedOrNot
         };
         _context.Supplier.Attach(model);
         model.IsRateAssignedToSupplier = isRateAssignedOrNot;
         _context.SaveChanges();
     }
     catch (Exception e)
     {
         Console.WriteLine(e);
         throw;
     }
 }
 public void  SetIsCustomerRateAssigned(int customerId, bool isRateAssignedOrNot)
 {
     try
     {
         var model = new Customer
         {
             Id = customerId,
             IsRateAssignedToCustomer = !isRateAssignedOrNot
         };
         _dbContext.Customers.Attach(model);
         model.IsRateAssignedToCustomer = isRateAssignedOrNot;
         _dbContext.SaveChanges();
     }
     catch (Exception e)
     {
         Console.WriteLine(e);
         throw;
     }
 }