예제 #1
0
        public IActionResult CreateFeedback(int id)
        {
            CreateFeedbackViewModel vm = new CreateFeedbackViewModel();

            vm.PackageId = id;
            vm.Package   = _repoPackage.GetSingle(p => p.PackageId == vm.PackageId);
            return(View(vm));
        }
        public async Task <IActionResult> Create(CreateFeedbackViewModel inputModel)
        {
            var currentUser = await this._userManager.GetUserAsync(HttpContext.User);

            var feedback = new Feedback
            {
                Content           = inputModel.Content,
                ApplicationUsedId = currentUser.Id,
                FlightId          = inputModel.FlightId
            };

            await this.feedbacks.Save(feedback);

            return(Ok());
        }
        public async Task <IActionResult> Create(CreateFeedbackViewModel model)
        {
            var feedback = Mapper.Map <Feedback>(model);

            var creationMessage = await this.feedbackService.CreateAsync(feedback);

            if (creationMessage != null)
            {
                TempData[WebConstants.WarningMessageKey] = creationMessage;
                return(View(model));
            }

            TempData[WebConstants.SuccessMessageKey] = "Feedback was posted Successfully";
            return(RedirectToAction(nameof(Details), new { feedback.ProductId, feedback.SenderId }));
        }
예제 #4
0
        public async Task <IActionResult> CreateFeedback(CreateFeedbackViewModel vm, int id)
        {
            if (ModelState.IsValid)
            {
                var loggedUser = await _userManagerService.FindByNameAsync(User.Identity.Name);

                Feedback feedback = new Feedback
                {
                    Content   = vm.FeedbackContent,
                    OrderId   = vm.OrderId,
                    PackageId = vm.PackageId
                };

                _feedbackRepo.Create(feedback);

                return(RedirectToAction("Display", "Package", new { id = vm.PackageId }));
            }

            return(RedirectToAction("Index", "Customer"));
        }
예제 #5
0
        public IActionResult CreateFeedback(CreateFeedbackViewModel vm)
        {
            if (ModelState.IsValid)
            {
                //Mapping
                Feedback f = new Feedback
                {
                    PackageId   = vm.PackageId,
                    Description = vm.Description,
                    UserName    = User.Identity.Name
                };

                //Save to DB
                _repoFeedback.Create(f);

                //Redirect to Index
                return(RedirectToAction("Packages", "Package"));//, new {id = vm.FeedbackId});
            }
            return(View(vm));
        }
예제 #6
0
        public async Task <IActionResult> NewFeedbackLife([FromBody] CreateFeedbackViewModel viewModel)
        {
            var feedback = new Feedback {
                LifeId  = viewModel.LifeId,
                Content = viewModel.Content
            };

            var user = await _userManager.FindByNameAsync(HttpContext.User.Identity.Name);

            feedback.IntegratorId = user.Id;

            try
            {
                await _feedbackService.Save(feedback);

                return(Ok());
            }
            catch (System.Exception)
            {
                return(BadRequest());
            }
        }
        public async Task <IActionResult> Create(string receiverId, int productId)
        {
            var loggedUserId = this.userManager.GetUserId(User);

            if (loggedUserId != receiverId)
            {
                var feedback = new CreateFeedbackViewModel
                {
                    SenderId   = loggedUserId,
                    ReceiverId = receiverId,
                    ProductId  = productId
                };

                return(View(nameof(Create), feedback));
            }
            else
            {
                TempData[WebConstants.WarningMessageKey] = "You cannot post feedback for your own products!";
                var product = await this.productService.GetProductAsync <ProductDetailsViewModel>(productId);

                return(RedirectToAction("Details", "Product", product));
            }
        }