public ActionResult <int> Create(ProductFeedback productFeedback)
        {
            int res = 0;

            res = _productFeedbackService.Create(productFeedback);
            return(res);
        }
        public ActionResult Create(ProductCommentViewModel commentViewModel)
        {
            if (ModelState.IsValid)
            {
                var comment = new ProductFeedback()
                {
                    Id        = commentViewModel.CommentId,
                    ProductId = commentViewModel.ProductId,
                    Comment   = commentViewModel.Comment,
                    CreatedAt = DateTime.Now,
                    UserId    = WebSecurity.CurrentUserId
                };

                try
                {
                    _productCommentRepository.Save(comment);
                }
                catch (DataException)
                {
                    TempData["error"] = ProjectConfiguration.Get.DataErrorMessage;
                }

                return(RedirectToAction("Feedbacks", "Product", new { Id = comment.ProductId }));
            }
            else
            {
                TempData["Comment"] = commentViewModel.Comment;
                return(RedirectToAction("Feedbacks", "Product", new { Id = commentViewModel.ProductId }));
            }
        }
 public bool SaveFeedback(ProductFeedback productFeedback)
 {
     using (var context = new UniversityEntities())
     {
         context.ProductFeedback.Add(productFeedback);
         context.SaveChanges();
         return(true);
     }
 }
        public ActionResult ProductFeedback(string message, string id)
        {
            ProductFeedback productFeedback = new ProductFeedback();

            productFeedback.FeedbackDescription = message;
            productFeedback.IsDeleted           = false;
            productFeedback.ProductId           = Convert.ToDecimal(id);
            productFeedback.CreatedDate         = DateTime.Now;
            bool savefeedback = _feedbackService.SaveFeedback(productFeedback);

            return(this.Json("Thank you for your feedback.", JsonRequestBehavior.AllowGet));
        }
        public IActionResult Update(string id, ProductFeedback memberIn)
        {
            var productFeedback = _productFeedbackService.Get(id);

            if (productFeedback == null)
            {
                return(NotFound());
            }

            _productFeedbackService.Update(id, memberIn);

            return(NoContent());
        }
Esempio n. 6
0
 public int Create(ProductFeedback productFeedback)
 {
     try
     {
         _productFeedback.InsertOne(productFeedback);
         return(1);
     }
     catch (Exception ex)
     {
         Console.WriteLine(ex.Message);
         return(0);
     }
 }
Esempio n. 7
0
 public bool ProductFeedbackCreate(ProductFeedback feedback)
 {
     try
     {
         _productFeedbacksRepository.Add(feedback);
         _productFeedbacksRepository.SaveChanges();
         return(true);
     }
     catch (Exception)
     {
         return(false);
     }
 }
Esempio n. 8
0
 public void Remove(ProductFeedback productFeedback) =>
 _productFeedback.DeleteOne(productFeedback => productFeedback.Id == productFeedback.Id);
Esempio n. 9
0
 public void Update(string id, ProductFeedback productFeedback) =>
 _productFeedback.ReplaceOne(productFeedback => productFeedback.Id == id, productFeedback);
Esempio n. 10
0
 public ProductFeedback Update(ProductFeedback entity, List <Expression <Func <ProductFeedback, object> > > update = null, List <Expression <Func <ProductFeedback, object> > > exclude = null)
 {
     return(_productFeedback.Update(entity, update, exclude));
 }
Esempio n. 11
0
 public ProductFeedback Delete(ProductFeedback entity)
 {
     return(_productFeedback.Delete(entity));
 }
Esempio n. 12
0
 public ProductFeedback Add(ProductFeedback entity)
 {
     return(_productFeedback.Add(entity));
 }
Esempio n. 13
0
 public bool SaveFeedback(ProductFeedback productFeedback)
 {
     return(_feedbackRepository.SaveFeedback(productFeedback));
 }