public List <string> ExecuteCommand(params string[] args) { var commandFeedback = new List <string>(); string feedbackSource = args[0]; if ((args.Length < 2 || args.Length > 3) || args[1] == "HELP") { commandFeedback.AddMessageCommand(feedbackSource, HelpText); return(commandFeedback); } string unparsedRating = args[1]; string details = args[2]; int rating; bool isRatingNumber = int.TryParse(unparsedRating, out rating); bool isValidRating = isRatingNumber && rating > 0 && rating < 6; if (!isValidRating) { commandFeedback.AddMessageCommand(feedbackSource, $"Your rating needs to be between 1 and 5, where 1 is really bad, and 5 is really good."); return(commandFeedback); } FeedbackService.Create(feedbackSource, rating, details); commandFeedback.AddMessageCommand(feedbackSource, $"Your feedback has been received. Thanks for telling us about what's going on!"); return(commandFeedback); }
public ActionResult CreateFeedBack([FromBody] FeedbackInput data) { var apiRep = new APIResponse(); apiRep.Data = _feedbackService.Create(data); return(Ok(apiRep)); }
public void CanLogFeedback() { PlayerService.Create("UnitTest"); FeedbackService.Create("UnitTest", 5, "UnitTest Feedback, yo!"); // Fetch feedback to see if it was saved. Normally, // I would do this on an as-needed basis... var feedbacks = FeedbackService.GetByPlayerName("UnitTest"); Assert.IsTrue(feedbacks.Count > 0); }
public void AdminCanReadSubmittedFeedback() { PlayerService.Create("SuperUser"); PlayerService.Create("UnitTest"); PlayerService.Create("Boba_Fett"); PlayerService.PromoteToAdmin("SuperUser"); FeedbackService.Create("UnitTest", 5, "This server is awesome!"); FeedbackService.Create("Boba_Fett", 3, "UnitTest is a n00b LOL!"); string serverOutput = "[CHANNELROUTER] RECEIVED MESSAGE ON Server(0): [CHAT][sender=SuperUser][receiverType=CHANNEL][receiver=Server][message=!READFEEDBACK]"; var expectedResult = new List <string> { "/server_message_to info SuperUser \"Rating: 5 - Details: This server is awesome!\"", "/server_message_to info SuperUser \"Rating: 3 - Details: UnitTest is a n00b LOL!\"" }; TestCommandOutput(serverOutput, expectedResult); }
public ActionResult Feedback(FormCollection fc) { var siteInfo = HiteContext.Current.Site; //对_ChannelLayout.cshtml的变量赋值 CategoryInfo catInfo = new CategoryInfo(); catInfo.BannerAdImageUrl = string.Format("/images/{0}feedback.jpg", siteInfo.Language == WebLanguage.zh_cn ? string.Empty : "en_"); catInfo.Name = ViewBag.SubNavCustomTitle = Hite.Mvc.LanguageResourceHelper.GetString("feedback-text", siteInfo.Language); ViewBag.RootCategoryInfo = ViewBag.CurrentCategoryInfo = catInfo; int flag = 0; FeedbackInfo model = new FeedbackInfo(); model.Company = fc["txtCompany"]; model.Email = fc["txtEmail"]; model.Intention = Goodspeed.Library.Char.HtmlHelper.RemoveHtml(fc["txtIntention"]); model.Intention = Goodspeed.Common.CharHelper.Truncate(model.Intention, 200); model.IP = Goodspeed.Common.BrowserInfo.Current.IP; model.Phone = fc["txtPhone"]; model.RealName = fc["txtRealName"]; model.Requirement = fc["cbRequirement"]; model.SiteId = siteInfo.Id; model.UserId = HiteContext.Current.UserInfo.Id; model.UserName = HiteContext.Current.UserInfo.UserName; int id = FeedbackService.Create(model).Id; if (id > 0) { flag = 1; //Success ViewBag.Flag = flag; } return(View("~/Views/Feedback/Index.cshtml")); }
public ActionResult Index(FeedbackInfo model, FormCollection fc) { /* * 设置_CommmonLayout.cshtml中的变量 */ ViewBag.RootCategoryInfo = ViewBag.CurrentCategoryInfo = CategoryService.Get(GeneralConfig.FeedbackRootId_DE); bool errors = false; if (string.IsNullOrEmpty(model.Title)) { errors = true; ModelState.AddModelError("Title", "Please enter a title"); } if (string.IsNullOrEmpty(model.Content)) { errors = true; ModelState.AddModelError("Content", "Please enter the content"); } if (ModelState.IsValid && !errors) { //过滤掉内容HTML model.Content = Goodspeed.Library.Char.HtmlHelper.RemoveHtml(model.Content); int id = FeedbackService.Create(model).Id; ViewBag.Status = false; if (id > 0) { ViewBag.Status = true; } } return(View()); }
public Feedback Create(Feedback entity) => _feedbackService.Create(entity);
public Feedback Create(Feedback feedback) => _service.Create(feedback);