Exemplo n.º 1
0
 public ActionResult Reply(FeedbackModel model)
 {
     try
     {
         var feedback = _feedbackService.GetFeedbackById(model.Id);
         if (feedback == null)
         {
             return(RedirectToAction("List"));
         }
         if (string.IsNullOrEmpty(model.ReplyContent))
         {
             ErrorNotification("Reply content is required!");
             return(RedirectToAction("Edit", new { id = feedback.Id }));
         }
         var currentUser = Session[Values.USER_SESSION] as UserModel;
         feedback.ReplierId       = currentUser.Id;
         feedback.RepliedDateTime = DateTime.Now;
         feedback.ReplyContent    = model.ReplyContent;
         SendEmailHelper.SendEmailToCustomer(feedback.Email, feedback.FullName, "Feedback information", feedback.ReplyContent);
         _feedbackService.AddReply(feedback);
         SuccessNotification("Reply feedback successfully!");
         return(RedirectToAction("Edit", new { id = feedback.Id }));
     }
     catch (Exception e)
     {
         ErrorNotification("Reply feedback failed!");
         return(RedirectToAction("Edit", new { id = model.Id }));
     }
 }