public ActionResult Create(long questionId)
        {
            var model = new QuestionItemModel
            {
                QuestionId = (int)questionId
            };

            return(View(model));
        }
        public ActionResult Edit(long id)
        {
            var item  = _hotelRepository.GetQuestionItem((int)id);
            var model = new QuestionItemModel
            {
                QuestionId       = item.Question.Id,
                Id               = item.Id,
                Items            = item.Items,
                Order            = item.ItemOrder,
                Title            = item.Title,
                QuestionItemType = item.QuestionItemType,
                Parts            = item.Parts,
                SingleSpace      = item.SingleSpace,
                Required         = item.Required
            };

            return(View(model));
        }
        public ActionResult Edit(QuestionItemModel model)
        {
            if (ModelState.IsValid)
            {
                var questionItem = _hotelRepository.GetQuestionItems().Where(p => p.Id == model.Id).FirstOrDefault();

                questionItem.Items            = model.Items;
                questionItem.QuestionItemType = model.QuestionItemType;
                questionItem.Title            = model.Title;
                questionItem.ItemOrder        = model.Order;
                questionItem.Question         = _hotelRepository.GetQuestions().Where(p => p.Id == model.QuestionId).FirstOrDefault();
                questionItem.Parts            = model.Parts;
                questionItem.SingleSpace      = model.SingleSpace;
                questionItem.Required         = model.Required;

                _hotelRepository.UploadQuestionItems(questionItem);

                TempData["Message-Success"] = "Poprawnie zaktualizowano element pytania";
                return(RedirectToAction("Index", new { questionId = model.QuestionId }));
            }

            return(View(model));
        }
        public ActionResult Create(QuestionItemModel model)
        {
            if (ModelState.IsValid)
            {
                var questionItem = new QuestionItem()
                {
                    Items            = model.Items,
                    QuestionItemType = model.QuestionItemType,
                    Title            = model.Title,
                    ItemOrder        = model.Order,
                    Question         = _hotelRepository.GetQuestions().Where(p => p.Id == model.QuestionId).FirstOrDefault(), //(model.QuestionId),
                    Parts            = model.Parts,
                    SingleSpace      = model.SingleSpace,
                    Required         = model.Required
                };
                _hotelRepository.UploadQuestionItems(questionItem);

                TempData["Message-Success"] = "Poprawnie dodano element pytania";
                return(RedirectToAction("Index", new { questionId = model.QuestionId }));
            }

            return(View(model));
        }