Beispiel #1
0
 public async Task <Coupon> AddCouponAsync(Coupon bond)
 {
     try
     {
         dbContext.Coupon.Add(bond);
         await dbContext.SaveChangesAsync();
     }
     catch (Exception)
     {
         throw;
     }
     return(bond);
 }
Beispiel #2
0
 public async Task <ClientCoupon> UpdateClientCouponAsync(ClientCoupon clientCoupon)
 {
     try
     {
         var clientExist = dbContext.ClientCoupon.FirstOrDefault(u => u.Id == clientCoupon.Id);
         if (clientExist != null)
         {
             dbContext.Update(clientCoupon);
             await dbContext.SaveChangesAsync();
         }
     }
     catch (Exception)
     {
         throw;
     }
     return(clientCoupon);
 }
Beispiel #3
0
 public async Task <Client> AddClientAsync(Client client)
 {
     try
     {
         if (dbContext.Client.Where(c => c.Email.ToLower() == client.Email.ToLower()).FirstOrDefault() != null)
         {
             return(null);
         }
         dbContext.Client.Add(client);
         await dbContext.SaveChangesAsync();
     }
     catch (Exception)
     {
         return(null);
     }
     return(client);
 }