public async Task<JsonResult> Query(string text) { var model = new ResponseModel { IsOk = false }; if (string.IsNullOrEmpty(text)) { return Json(model, JsonRequestBehavior.AllowGet); } var result = await _searchService.Query(text); if (result == null) { return Json(model, JsonRequestBehavior.AllowGet); } model.Result = result; model.IsOk = true; return Json(model, JsonRequestBehavior.AllowGet); }
public async Task<JsonResult> SaveFeedback(string info, string email) { var model = new ResponseModel { IsOk = false }; SetPleaseTryAgain(model); if (string.IsNullOrEmpty(info)) return Json(model, JsonRequestBehavior.DenyGet); if (User.Identity.IsAuthenticated) { model.IsOk = await _feedbackService.AddFeedback(User.Identity.GetUserId(), User.Identity.GetUserEmail(), info); } else { email = email == ConstHelper.undefined ? string.Empty : email; model.IsOk = await _feedbackService.AddFeedback(null, email, info); } return Json(model, JsonRequestBehavior.DenyGet); }