예제 #1
0
        public IActionResult CreateSaved(Pricetranfer pricetranfer)
        {
            StatusQuery Notification;

            if (ModelState.IsValid)
            {
                try
                {
                    _pricetranfer.Insert(pricetranfer);
                    var statusInsert = _pricetranfer.SaveChanges();
                    if (statusInsert > 0)
                    {
                        TempDataHelper.Put <StatusQuery>(TempData, "Notification", new StatusQuery("success", "", "Thêm thành công"));
                        return(RedirectToAction("Index", "Tranfer"));
                    }
                    else
                    {
                        Notification   = new StatusQuery("error", "", "Thêm mới thất bại");
                        ViewBag.Status = Notification.Status;
                        ViewBag.Value  = Notification.Value;
                        ViewBag.Type   = Notification.Type;
                    }
                }
                catch (Exception)
                {
                    return(View(pricetranfer));
                }
            }
            else
            {
                return(View(pricetranfer));
            }
            return(View(pricetranfer));
        }
예제 #2
0
        public ActionResult Create(Favourite favourite)
        {
            StatusQuery Notification;

            if (ModelState.IsValid)
            {
                try
                {
                    _favouriteRepo.Insert(favourite);
                    var statusInsert = _favouriteRepo.SaveChanges();
                    if (statusInsert > 0)
                    {
                        TempDataHelper.Put <StatusQuery>(TempData, "Notification", new StatusQuery("success", "", "Thêm thành công"));
                        return(RedirectToAction("Index", "Favourite"));
                    }
                    else
                    {
                        Notification   = new StatusQuery("error", "", "Thêm mới thất bại");
                        ViewBag.Status = Notification.Status;
                        ViewBag.Value  = Notification.Value;
                        ViewBag.Type   = Notification.Type;
                    }
                }
                catch (Exception)
                {
                    return(View(favourite));
                }
            }
            return(View(favourite));
        }
예제 #3
0
        private LightFeedbackVm UpdateTempData(LightFeedbackVm lightingSurveyVm, bool displaySameView)
        {
            var currentVm       = TempDataHelper.Get <LightFeedbackVm>(TempData, _feedbackTempDataKey);
            var updatedTempData = _tempDataService.UpdateTempData(currentVm, lightingSurveyVm, displaySameView);

            TempDataHelper.Put <LightFeedbackVm>(TempData, _feedbackTempDataKey, updatedTempData);
            return(updatedTempData);
        }
예제 #4
0
        public IActionResult GetViewById(int viewId)
        {
            var feedbackTempData = TempDataHelper.Get <LightFeedbackVm>(TempData, _feedbackTempDataKey);
            var viewToDisplay    = _lightFeedbackService.GetFeedbackQuestion(viewId);

            feedbackTempData.CurrentStep = viewId;
            TempDataHelper.Put <LightFeedbackVm>(TempData, _feedbackTempDataKey, feedbackTempData);
            return(PartialView(viewToDisplay, feedbackTempData));
        }
        public IActionResult DeleteChanged(int id)
        {
            var _formationdelete = _formation.GetById(id);

            _formation.Delete(_formationdelete);
            var statusdelete = _formation.SaveChanges();

            if (statusdelete > 0)
            {
                TempDataHelper.Put <StatusQuery>(TempData, "Notification", new StatusQuery("error", "", "Xoá thành công"));
            }
            return(RedirectToAction("Index", "Information"));
        }
예제 #6
0
        public IActionResult Index()
        {
            var currentView = new LightFeedbackVm()
            {
                FullNameVm  = new FullNameVm(),
                EmailVm     = new EmailVm(),
                HomeAddress = new AddressVm(),
                CurrentStep = 1
            };

            TempDataHelper.Put <LightFeedbackVm>(TempData, _feedbackTempDataKey, currentView);
            return(View(currentView));
        }
예제 #7
0
        public IActionResult DeleteConfirm(int id)
        {
            var _vehicle = _vehicletypeRepository.GetById(id);

            _vehicletypeRepository.Delete(_vehicle);
            var statusDelete = _vehicletypeRepository.SaveChanges();

            if (statusDelete > 0)
            {
                TempDataHelper.Put <StatusQuery>(TempData, "Notification", new StatusQuery("success", "", "Xoa thanh cong"));
                return(RedirectToAction("Create", "VehicleType"));
            }

            return(RedirectToAction("Index"));
        }
예제 #8
0
        public IActionResult Index()
        {
            var lightFeedbackVm = TempDataHelper.Get <LightFeedbackVm>(TempData, _feedbackTempDataKey);

            if (lightFeedbackVm == null)
            {
                lightFeedbackVm = _tempDataService.InitialiseViewModel();
            }
            else
            {
                lightFeedbackVm.CurrentStep = 1;
            }

            TempDataHelper.Put <LightFeedbackVm>(TempData, _feedbackTempDataKey, lightFeedbackVm);
            return(View(lightFeedbackVm));
        }
예제 #9
0
        public ActionResult Edit(Favourite model)
        {
            var editfavourite = _favouriteRepo.GetById(model.Id);

            editfavourite.Id    = model.Id;
            editfavourite.Name  = model.Name;
            editfavourite.Image = model.Image;
            editfavourite.Icon  = model.Icon;
            var statusedit = _favouriteRepo.SaveChanges();

            if (statusedit > 0)
            {
                TempDataHelper.Put <StatusQuery>(TempData, "Notification", new StatusQuery("success", "", "Sửa thành công"));
                return(RedirectToAction("Index", "Favourite"));
            }
            return(View(editfavourite));
        }
        public IActionResult EditConfirm(Information model)
        {
            var _formationedit = _formation.GetById(model.Id);

            _formationedit.Id          = model.Id;
            _formationedit.Name        = model.Name;
            _formationedit.Descreption = model.Descreption;
            _formationedit.Club        = model.Club;
            _formationedit.Image       = model.Image;
            _formationedit.Number      = model.Number;
            var statusEdit = _formation.SaveChanges();

            if (statusEdit > 0)
            {
                TempDataHelper.Put <StatusQuery>(TempData, "Notification", new StatusQuery("warning", "", "Sửa thành công"));
            }
            return(RedirectToAction("Index", "Information"));
        }
예제 #11
0
        public ActionResult EditSaved(Pricetranfer model)
        {
            var _pricetranferedit = _pricetranfer.GetById(model.Id);

            _pricetranferedit.Id        = model.Id;
            _pricetranferedit.Name      = model.Name;
            _pricetranferedit.PriceBuy  = model.PriceBuy;
            _pricetranferedit.PriceSell = model.PriceSell;
            _pricetranferedit.Ovr       = model.Ovr;
            _pricetranferedit.Image     = model.Image;
            var statusEdit = _pricetranfer.SaveChanges();

            if (statusEdit > 0)
            {
                TempDataHelper.Put <StatusQuery>(TempData, "Notification", new StatusQuery("success", "", "Sửa thành công"));
                return(RedirectToAction("Index", "Tranfer"));
            }
            return(View(_pricetranferedit));
        }
        public ActionResult Create(Information information)
        {
            StatusQuery Notification;

            if (ModelState.IsValid)
            {
                try
                {
                    var obj = _formation.GetAll().FirstOrDefault(item => item.Name.ToLower() == information.Name.ToLower());
                    if (obj != null)
                    {
                        Notification   = new StatusQuery("warning", "", "Vui lòng kiểm tra lại");
                        ViewBag.Status = Notification.Status;
                        ViewBag.Value  = Notification.Value;
                        ViewBag.Type   = Notification.Type;
                        ModelState.AddModelError("Name", "Tên người dùng đã tồn tại");
                        return(View(information));
                    }
                    _formation.Insert(information);
                    var statusInsert = _formation.SaveChanges();
                    if (statusInsert > 0)
                    {
                        TempDataHelper.Put <StatusQuery>(TempData, "Notification", new StatusQuery("success", "", "Thêm thành công"));
                        return(RedirectToAction("Index", "Information"));
                    }
                }
                catch (Exception)
                {
                    return(View(information));
                }
            }
            else
            {
                return(View(information));
            }
            return(RedirectToAction("Index"));
        }