示例#1
0
        public bool AddFeedback(CropsFeedback feedback)
        {
            context.CropsFeedbacks.Add(feedback);

            context.SaveChanges();
            return(true);
        }
示例#2
0
        public ActionResult Add(IFormCollection form)
        {
            var comment = form["Comment"].ToString();
            var cropId  = int.Parse(form["ArticleId"]);
            var rating  = int.Parse(form["Rating"]);

            CropsFeedback artComment = new CropsFeedback()
            {
                CropId       = cropId,
                Feedback     = comment,
                Rating       = rating,
                ThisDateTime = DateTime.Now
            };

            repository.AddFeedback(artComment);

            return(RedirectToAction("Crop", "Home", new { cropID = artComment.CropId }));
        }