private async Task <IActionResult> ProcessSmileResult(SmileCountViewModel model) { model.Smile.IpAddress = Request.HttpContext.Connection.RemoteIpAddress.ToString(); if (!await _repository.AddSmileAsync(model.Smile)) { return(View("Error")); } var commentAnalyzeresult = await _textAnalyzeService.AnalyzeTextAsync(model.Smile.Why); return(View(commentAnalyzeresult)); }
public async Task <IActionResult> Index() { try { var model = new SmileCountViewModel() { SmileUpCount = await _repository.CountSmileUp(), SmileDownCount = await _repository.CountSmileDown() }; return(View(model)); } catch { return(View("Error")); } }
public async Task <IActionResult> UnhappySmile(SmileCountViewModel model) { model.Smile.IsHappy = false; return(await ProcessSmileResult(model)); }