public ActionResult SaveReview() { if (Globals.isLoggedIn() == false) { return(RedirectToAction("Index", "Authentication")); } ServiceBusConnection connection = ConnectionManager.getConnectionObject(Globals.getUser()); if (connection == null) { return(RedirectToAction("Index", "Authentication")); } String review = Request.Form["reviewData"]; String company = Request.Form["companyName"]; int time = (int)DateTimeOffset.Now.ToUnixTimeSeconds(); String rating = Request.Form["star"]; string json = "{review:{companyName:\"" + company + "\"," + "username:\"" + Globals.getUser() + "\"," + "review:\"" + review + "\"," + "stars:" + rating + "," + "timestamp:" + time + "}}"; SaveReviewRequest srRequest = new SaveReviewRequest(company, json); ServiceBusResponse response = connection.saveCompanyReview(srRequest); Response.Write("<script>alert('" + response.response + "')</script>"); return(View("Index")); }
public ActionResult SaveReview(string textUserReview, string rating, string companyName) { if (Globals.isLoggedIn() == false) { return(RedirectToAction("Index", "Authentication")); } ServiceBusConnection connection = ConnectionManager.getConnectionObject(Globals.getUser()); if (connection == null) { return(RedirectToAction("Index", "Authentication")); } ReviewInstance review = new ReviewInstance(companyName, textUserReview, Convert.ToInt32(rating), DateTimeOffset.Now.ToUnixTimeSeconds(), Globals.getUser()); SaveCompanyReviewRequest request = new SaveCompanyReviewRequest(review); SaveCompanyReviewResponse response = connection.saveCompanyReview(request); return(RedirectToAction("DisplayCompany", new { id = companyName })); }
public ActionResult WriteReview(string company = "", string userReview = "", int timestamp = -1, int stars = -1) { if (Globals.isLoggedIn() == false || company == "" || userReview == "" || timestamp == -1 || stars == -1) { return(RedirectToAction("Index", "Authentication")); } ServiceBusConnection connection = ConnectionManager.getConnectionObject(Globals.getUser()); if (connection == null) { return(RedirectToAction("Index", "Authentication")); } SaveCompanyReviewRequest request = new SaveCompanyReviewRequest(new CustomerReview(company, Globals.getUser(), userReview, stars, timestamp)); ServiceBusResponse response = connection.saveCompanyReview(request); return(null); }