Mark Tabor

Mark Tabor

  • 554
  • 2k
  • 465.1k

async Action Result does not end

Jan 7 2020 4:15 AM
hi I have a requirement in which i am updating the token number i am using SpeechSynthesizer but after the sound play my is not returning it is in blocking mode and never end execution.
  1. public async Task<ActionResult> UpdateCounter(Counter counter)  
  2. {  
  3. using (CounterAppForANTHEntities1 entities = new CounterAppForANTHEntities1())  
  4. {  
  5. Counter updatedCustomer = (from c in entities.Counters  
  6. where c.id == 1  
  7. select c).FirstOrDefault();  
  8. updatedCustomer.Counter_value = updatedCustomer.Counter_value+1;  
  9. Console.Beep(767, 800);  
  10. entities.SaveChanges();  
  11. SpeechSynthesizer synthesizer = new SpeechSynthesizer();  
  12. synthesizer.Rate = 0;  
  13. synthesizer.Volume = 100;  
  14. int res = updatedCustomer.Counter_value;  
  15. string value = "Token Number" + IntToString(res);  
  16. //await Task.Delay(3000);  
  17. synthesizer.SpeakAsync(value);  
  18. return View(updatedCustomer);  
  19. // return RedirectToAction("Index");  
  20. }  
  21. return RedirectToAction("Index");  
  22. }  

Answers (1)