public void AddComment(UserComment UserComment) { if (UserComments == null) { UserComments = new List<UserComment>(); } UserComments.Add(UserComment); }
public ActionResult AddComment(int id, UserComment _UserComment) { Product ViewProduct = Product.GetProduct(Convert.ToInt32(id)); ViewData["Product"] = ViewProduct; if (ModelState.IsValid) { ViewProduct.AddComment(_UserComment); ViewData["SuccessMessgae"] = "Comment Successfully Add"; } return View(_UserComment); }
public static void AddComment(int ProductId, string Comment, string UserName) { Product Product = Products[ProductId]; UserComment UserComment = new UserComment(Comment, UserName); Product.AddComment(UserComment); }