예제 #1
0
        public ActionResult Create(StockUserViewModel newUser, IFormCollection collection)
        {
            try
            {
                //newUser.user.Email = newUser.loginUserId;
                // TODO: Add insert logic here
                newUser.loginUserId = this.User.Identity.Name;
                _StockUserRepo.AddUser(newUser.user);
                newUser.userTransId = newUser.user.Id;

                return(View(newUser));

                //return RedirectToAction(nameof(Index));
            }
            catch
            {
                return(View());
            }
        }
예제 #2
0
        // GET: User/Create
        public ActionResult Create()
        {
            StockUserViewModel stockUser = new StockUserViewModel();

            stockUser.loginUserId = this.User.Identity.Name;
            stockUser.userTransId = 0;
            // stockUser.user.Id = 0;
            //lookup email--if exists, populate form with data
            StockUser userFound = _StockUserRepo.GetUserInfo(stockUser.loginUserId);

            if (userFound != null)
            {
                //populate view model with stockuser data
                stockUser.user.Id           = userFound.Id;
                stockUser.user.FName        = userFound.FName;
                stockUser.user.LName        = userFound.LName;
                stockUser.user.TotCash      = userFound.TotCash;
                stockUser.user.TotEquity    = userFound.TotEquity;
                stockUser.user.TotPortfolio = userFound.TotPortfolio;
            }

            return(View(stockUser));
        }