public ActionResult Index(String product) { SetSeoInformation(product); ViewBag.Scripts = new List <string>() { "review.js" }; ViewBag.HasNoFollow = true; ReviewItemModel reviewItemModel = new ReviewItemModel(); try { reviewItemModel.BreadCrumbAndProductId = product; ProductDetailModel productDetail = DetailManager.GetProductDetailModel(product); reviewItemModel.ProductCode = productDetail.Code; reviewItemModel.ProductDescription = productDetail.Description; reviewItemModel.ProductName = productDetail.Name; reviewItemModel.ProductImage = productDetail.Image; reviewItemModel.Rating = "5"; reviewItemModel.Average = DetailManager.GetProductReviewAverage(product); } catch { return(RedirectToAction("Index", "Home")); } return(View(PathFromView("Review"), reviewItemModel)); }
public ReviewItemViewModel(ReviewItemModel reviewItemModel) { ChangesetId = reviewItemModel.ChangesetId; Comment = reviewItemModel.Comment; CreationDate = reviewItemModel.CreationDate; Committer = reviewItemModel.Committer; ServerItem = reviewItemModel.ServerItem; Change = reviewItemModel.Change; LocalFilePath = reviewItemModel.LocalFilePath; }
public static bool Create(ReviewItemModel reviewItemModel) { using (var client = new LandauPortalWebAPI()) { var productReview = new ProductReviewCreate(); productReview.Comments = reviewItemModel.Comments; Char[] whitespace = new char[] { ' ', '\t' }; String [] names = reviewItemModel.CommentatorName.Split(null); if (names.Count() > 0) { if (names.Count() == 1) { productReview.FirstName = names[0].Trim(); productReview.LastName = names[0].Trim(); } else if (names.Count() == 2 || names.Count() > 2) { productReview.FirstName = names[0].Trim(); productReview.LastName = reviewItemModel.CommentatorName.Replace(names[0], "").Trim(); } } productReview.ProductCode = reviewItemModel.ProductCode; productReview.Rating = Convert.ToInt16(reviewItemModel.Rating); /// Landau: Added Title, Location and Email. productReview.Title = reviewItemModel.Title; productReview.Location = reviewItemModel.Location; productReview.Email = reviewItemModel.Email; try { client.ProductReviews.Create(productReview.ProductCode, productReview); return(true); } catch (Exception e) { if (e is HttpOperationException) { var httpEx = (HttpOperationException)e; return(httpEx.Response.IsSuccessStatusCode); } } return(false); } }
public ActionResult Index(ReviewItemModel reviewItemModel) { SetSeoInformation(reviewItemModel.ProductCode); ViewBag.Scripts = new List <string>() { "review.js" }; ViewBag.HasNoFollow = true; if (ModelState.IsValid && reviewItemModel.Email.ToLower().Trim() == reviewItemModel.EmailConfirmation.ToLower().Trim()) { //TODO -> review validation var ok = ReviewManager.Create(reviewItemModel); if (ok) { return(Redirect(this.Request.Url.AbsoluteUri + "/" + Common.UrlBuilder.REVIEW_THANK_YOU)); } return(Redirect(this.Request.Url.AbsoluteUri.Replace("/review/", "/"))); } return(View(PathFromView("Review"), reviewItemModel)); }
private BaseItemModel GetNewItemByType(ItemTypeEnum itemType) { BaseItemModel result = null; switch (itemType) { case ItemTypeEnum.Author: result = new AuthorItemModel(); break; case ItemTypeEnum.Book: result = new BookItemModel(); break; case ItemTypeEnum.Serie: result = new SerieItemModel(); break; case ItemTypeEnum.Review: result = new ReviewItemModel(); break; } return(result); }