Ejemplo n.º 1
0
        public string SignIn()
        {
            var formCollection = Request.Form;

            formCollection.TryGetValue("login", out var login);
            formCollection.TryGetValue("password", out var password);

            if (AddUserOrCheckPass(login, password))
            {
                if (formCollection.TryGetValue("vendorToken", out var token) && !string.IsNullOrEmpty(token))
                {
                    _vendorInfos.Add(login, new VendorInfo
                    {
                        Token       = token,
                        ModelSeries = new HashSet <string>()
                    });
                }

                var session = _sessionSource.GetSession();
                _sessions.Add(session, login);
                return(session);
            }

            throw new Exception("Users already exist");
        }