private void UpdateIsRead(int feedbackId) { CredentialManage credential = JsonConvert.DeserializeObject <CredentialManage>(HttpContext.Session.GetString(Constants.VM_MANAGE)); Feedback feedback = GetApiFeedbacks.GetFeedbacks(credential.JwToken).SingleOrDefault(p => p.FeedbackId == feedbackId); // update feedback.IsRead = !feedback.IsRead; GetApiFeedbacks.Update(feedback, credential.JwToken); }
public IActionResult UpdateAllIsRead() { CredentialManage credential = JsonConvert.DeserializeObject <CredentialManage>(HttpContext.Session.GetString(Constants.VM_MANAGE)); List <Feedback> feedbacks = GetApiFeedbacks.GetFeedbacks(credential.JwToken).ToList(); foreach (var feedback in feedbacks) { feedback.IsRead = true; GetApiFeedbacks.Update(feedback, credential.JwToken); } return(RedirectToAction("Index")); }