Ejemplo n.º 1
0
        public IActionResult WriteFeedback(int productId)
        {
            var model = new WriteFeedbackViewModel();

            model.ProductID = productId;

            return(View(model));
        }
Ejemplo n.º 2
0
        public async Task <IActionResult> WriteFeedback(WriteFeedbackViewModel model)
        {
            var user = await _userManager.GetUserAsync(HttpContext.User);

            var feedback = new Feedback
            {
                FeedbackMessage = model.FeedbackMessage,
                UserID          = user.Id,
                DateCreated     = DateTime.Now,
                IsArchived      = false,
                Rating          = model.Rating,
                ProductID       = model.ProductID
            };

            _context.Feedbacks.Add(feedback);

            await _context.SaveChangesAsync();

            return(RedirectToAction(nameof(Success)));
        }
Ejemplo n.º 3
0
        public WriteFeedbackPage()
        {
            InitializeComponent();

            BindingContext = vm = new WriteFeedbackViewModel(this);
        }