public ApiResult Complaint([FromBody] CreateFeedbackModel feedback) { Argument.ThrowIfNullOrEmpty(feedback.Content, "投诉内容"); if (feedback.OrderId.Equals(Guid.Empty)) { throw new WebApiInnerException("0001", "订单Id不合法"); } if (feedback.Content.Length > 900) { throw new WebApiInnerException("0002", "投诉内容太长"); } var order = _currencyService.GetSingleById <Order>(feedback.OrderId); if (order == null) { throw new WebApiInnerException("0003", "订单不存在"); } if (order.OrderStatus != OrderStatus.Completed) { throw new WebApiInnerException("0004", "订单未完成,不可以投诉"); } if (!order.MemberId.Equals(AuthorizedUser.Id)) { throw new WebApiInnerException("0005", "只能投诉自己的订单"); } var model = new Feedback.Models.Feedback() { Content = $"单号:{order.OrderNo},{feedback.Content}", FeedbackType = FeedbackType.Complaint, SourceId = feedback.OrderId, SourceType = "Order", MemberId = AuthorizedUser.Id.ToGuid(), ModuleKey = OrderProcessModule.Key, ModuleName = OrderProcessModule.DisplayName }; _feedbackService.CreateFeedback(model, feedback.ImageFiles); ApiResult result = new ApiResult(); return(result); }
public ActionResult Create(CreateFeedbackModel feedback) { if (feedback != null && ModelState.IsValid) { var currentUserId = this.User.Identity.GetUserId(); var databaseFeedback = new Feedback() { Title = feedback.Title, Content = this.sanitizer.Sanitize(feedback.Content), AuthorId = currentUserId }; this.feedbacks.Add(databaseFeedback); this.feedbacks.SaveChanges(); return this.RedirectToAction("Index", "Home", new { notificationMessage = "You have successfully created a feedback!" }); } return this.View(feedback); }
public ActionResult Create(CreateFeedbackModel feedback) { if (feedback != null && ModelState.IsValid) { var currentUserId = this.User.Identity.GetUserId(); var databaseFeedback = new Feedback() { Title = feedback.Title, Content = this.sanitizer.Sanitize(feedback.Content), AuthorId = currentUserId }; this.feedbacks.Add(databaseFeedback); this.feedbacks.SaveChanges(); return(this.RedirectToAction("Index", "Home", new { notificationMessage = "You have successfully created a feedback!" })); } return(this.View(feedback)); }
public ApiResult Create([FromBody] CreateFeedbackModel feedback) { Argument.ThrowIfNullOrEmpty(feedback.Content, "反馈内容"); var model = new Models.Feedback() { Content = feedback.Content, FeedbackType = feedback.FeedbackType, SourceType = SourceTpye, MemberId = AuthorizedUser.Id.ToGuid(), ModuleKey = FeedbackModule.Key, ModuleName = FeedbackModule.DisplayName }; _feedbackService.CreateFeedback(model); ApiResult result = new ApiResult(); return(result); }
public ActionResult Create() { var model = new CreateFeedbackModel(); return this.View(model); }
public ActionResult Create() { var model = new CreateFeedbackModel(); return(this.View(model)); }