public async Task SendBulkCode(Dictionary <Customer, string> customerCodes) { foreach (var customer in customerCodes.Keys) { var code = customerCodes[customer]; await codeSender.SendCode(customer, code); } }
public ActionResult SendCode(Guid id) { // we send the code here string code = (new Random()).Next(100000, 999999).ToString(); var customer = _db.Customers.FirstOrDefault(c => c.Id == id); if (customer != null) { _codeSender.SendCode(customer, code); } return(RedirectToAction("Index")); }