Beispiel #1
0
        public ActionResult AddDolar(DolarViewModel dolarModel)
        {
            List<string> errors;
            if (Session["val"] != null)
            {
                errors = ((string[])Session["val"]).ToList();
            }
            else
            {
                errors = new List<string>();
            }

            DolarDto _dolarDto = new DolarDto();

            _dolarDto.User_ID = dolarModel.viewModel.User_ID;
            _dolarDto.Login = dolarModel.viewModel.User_Login;
            _dolarDto.Value = dolarModel.viewModel.DolarValue;

            if (_dolarService.Add(_dolarDto))
            {
                errors.Add("Dodano pieniądze.");
            }
            else
            {
                errors.Add("Błąd. Spróbuj ponownie.");
            }
            Session["val"] = errors.ToArray<string>();

            return RedirectToAction("Admin");
        }
Beispiel #2
0
        public ActionResult _DolarList()
        {
            DolarViewModel dolarModel = new DolarViewModel();

            dolarModel.listModel = _dolarService.GetDolars().Select(x => new ItemDolarViewModel
            {
                ID = x.ID,
                User_ID = x.User_ID,
                User_Login = x.Login,
                DolarValue = x.Value
            }).ToList();

            dolarModel.allUser = _userService.GetUser().Select(x => x.Login).ToArray();

            return View(dolarModel);
        }