This commit is contained in:
@@ -90,7 +90,7 @@ namespace rockfishCore.Controllers
|
||||
throw;
|
||||
}
|
||||
}
|
||||
updateCustomerActive(purchase.CustomerId);
|
||||
// updateCustomerActive(purchase.CustomerId);
|
||||
ParseOrderAndUpdateEmail(purchase);
|
||||
return NoContent();
|
||||
}
|
||||
@@ -107,7 +107,7 @@ namespace rockfishCore.Controllers
|
||||
_context.Purchase.Add(purchase);
|
||||
await _context.SaveChangesAsync();
|
||||
|
||||
updateCustomerActive(purchase.CustomerId);
|
||||
// updateCustomerActive(purchase.CustomerId);
|
||||
ParseOrderAndUpdateEmail(purchase);
|
||||
|
||||
return CreatedAtAction("GetPurchase", new { id = purchase.Id }, purchase);
|
||||
@@ -132,7 +132,9 @@ namespace rockfishCore.Controllers
|
||||
_context.Purchase.Remove(purchase);
|
||||
await _context.SaveChangesAsync();
|
||||
|
||||
updateCustomerActive(customerId);
|
||||
//removed, now have the concept of lapsed so active should be in manual control
|
||||
//
|
||||
// updateCustomerActive(customerId);
|
||||
return Ok(purchase);
|
||||
}
|
||||
|
||||
@@ -141,24 +143,24 @@ namespace rockfishCore.Controllers
|
||||
return _context.Purchase.Any(e => e.Id == id);
|
||||
}
|
||||
|
||||
//check if customer has any active subs and flag accordingly
|
||||
private void updateCustomerActive(long customerId)
|
||||
{
|
||||
var cust = _context.Customer.First(m => m.Id == customerId);
|
||||
bool active = hasActiveSubs(customerId);
|
||||
if (cust.Active != active)
|
||||
{
|
||||
cust.Active = active;
|
||||
_context.Customer.Update(cust);
|
||||
_context.SaveChanges();
|
||||
}
|
||||
}
|
||||
// //check if customer has any active subs and flag accordingly
|
||||
// private void updateCustomerActive(long customerId)
|
||||
// {
|
||||
// var cust = _context.Customer.First(m => m.Id == customerId);
|
||||
// bool active = hasActiveSubs(customerId);
|
||||
// if (cust.Active != active)
|
||||
// {
|
||||
// cust.Active = active;
|
||||
// _context.Customer.Update(cust);
|
||||
// _context.SaveChanges();
|
||||
// }
|
||||
// }
|
||||
|
||||
//check if a customer has active subscriptions
|
||||
private bool hasActiveSubs(long customerId)
|
||||
{
|
||||
return _context.Purchase.Where(m => m.CustomerId == customerId && m.CancelDate == null).Count() > 0;
|
||||
}
|
||||
// //check if a customer has active subscriptions
|
||||
// private bool hasActiveSubs(long customerId)
|
||||
// {
|
||||
// return _context.Purchase.Where(m => m.CustomerId == customerId && m.CancelDate == null).Count() > 0;
|
||||
// }
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user