public List <LoginMembership> GetLoginMembership()
        {
            var     loginsList = new List <LoginMembership>();
            DataSet ds         = new DataSet();
            string  query      = Resources.LoginMembership;

            try
            {
                ds = (DataSet)ExecuteQuery(query);
                foreach (DataTable t in ds.Tables)
                {
                    foreach (DataRow r in t.Rows)
                    {
                        LoginMembership LM = new LoginMembership();
                        LM.LoginName  = (String)r["LoginName"];
                        LM.Type       = (String)r["Type"];
                        LM.ServerRole = (String)r["ServerRole"];
                        LM.Disabled   = Convert.ToBoolean(r["is_disabled"]);
                        LM.Def_DBName = (String)r["default_database_name"];
                        loginsList.Add(LM);
                    }
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine("Exception catched: " + ex.Message);
                throw;
                //Console.WriteLine("Exception catched: " + ex.Message);
                //DO2.Success = false;
            }

            return(loginsList);
        }
 public LoginMembership Insert(LoginMembership obj)
 {
     using (InsightEntities db = new InsightEntities())
     {
         db.LoginMembership.Add(obj);
         db.SaveChanges();
         return(obj);
     }
 }
Beispiel #3
0
        public async Task <IActionResult> Login([FromBody] LoginModel model)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(model));
            }

            using (var client = _clientFactory.CreateClient())
            {
                var result = await LoginMembership.GetAccessToken(client, model);

                return(Ok(result));
            }
        }
 public static LoginMembership Insert(LoginMembership obj)
 {
     return(repository.Insert(obj));
 }