예제 #1
0
        public ActionResult Add(Guid id)
        {
            AddCommentsViewModel model = new AddCommentsViewModel();

            model.NotificationId = id;
            return(View(model));
        }
예제 #2
0
        public async Task <ActionResult> AddComments(AddCommentsViewModel addCommentsView)
        {
            var user = await UserManager.FindByIdAsync(User.Identity.GetUserId());

            //if (ModelState.IsValid)
            //{


            var comment = new Comments
            {
                Id       = Guid.NewGuid().ToString(),
                Text     = addCommentsView.Text,
                Note     = addCommentsView.Note,
                UserId   = user.Id,
                DateComm = DateTime.Now,
                HotelId  = addCommentsView.HotelId
            };

            db.Comments.Add(comment);
            db.SaveChanges();
            TempData["Message"] = "Отзыв успешно добавлен.";
            return(RedirectToAction("SearchHotel", "Home"));
            //}
            //return PartialView(addCommentsView);
        }
예제 #3
0
        public ActionResult AddCommentsModal(string Id)
        {
            ViewBag.Id = Id;
            AddCommentsViewModel addCommentsView = new AddCommentsViewModel {
                HotelId = db.Hotels.Find(Id).Id
            };

            //Comments comments = new Comments { HotelId = db.Hotels.Find(Id).Id };

            return(PartialView(addCommentsView));
        }
예제 #4
0
        public async Task <ActionResult> Add(AddCommentsViewModel model)
        {
            if (!ModelState.IsValid)
            {
                model.ModelIsValid = false;
                return(View(model));
            }

            var request = new AddNotificationComment(model.NotificationId, User.GetUserId(), model.Comment, model.ShipmentNumber.GetValueOrDefault(), DateTime.Now);

            await this.mediator.SendAsync(request);

            return(RedirectToAction("Index", new { id = model.NotificationId, type = model.SelectedType }));
        }
        public async Task <JsonNetResult> AddComments(AddCommentsViewModel model)
        {
            await _sampleDataService.AddSampleComments(new AddSampleComments { NumberOfComments = model.NumberOfComments });

            return(JsonSuccess());
        }