示例#1
0
        public ActionResult DeleteUser([DataSourceRequest] DataSourceRequest request, User user)
        {
            if (user != null)
            {
                DataProvider.Delete(user);
            }

            return Json(new[] { user }.ToDataSourceResult(request, ModelState));
        }
示例#2
0
        public ActionResult UpdateUser([DataSourceRequest] DataSourceRequest request, User user)
        {
            if (user != null && ModelState.IsValid)
            {
                DataProvider.Update(user);
            }

            return Json(new[] { user }.ToDataSourceResult(request, ModelState));
        }
示例#3
0
        public bool Authenticate(Credentials credentials)
        {
            string connectionString = CreateConnectionString(credentials.Username, credentials.Password);

            var provider = new MsSqlDataProvider(connectionString);

            if (provider.TestConnection())
            {
                dataProvider = provider;
                User = provider.GetItem(new UserDataFilter { Login = credentials.Username });
                return true;
            }

            return false;
        }