示例#1
0
        public ActionResult Delete(int id)
        {
            AppUser      user    = _userManager.FindById(User.Identity.GetUserId());
            DataBaseInfo foundDb = DataBasesManager.GetDbInfos(user.Id).Single(db => db.Id == id);

            return(PartialView(foundDb));
        }
示例#2
0
        public ActionResult ShowConnectionString(int id)
        {
            //Find user
            AppUser user = _userManager.FindById(User.Identity.GetUserId());
            //Find DB
            DataBaseInfo foundDb = DataBasesManager.GetDbInfos(user.Id).Single(db => db.Id == id);

            return(PartialView("WatchConnectionString", foundDb.ConnectionString));
        }
示例#3
0
        public ActionResult GoToEditingProtected()
        {
            var id =
                DataBasesManager.GetDbInfos(User.Identity.GetUserId())
                .OrderByDescending(db => db.DateOfCreating)
                .First()
                .Id;

            return(RedirectToAction("Index", "DisplayTable", new { dbId = id }));
        }
示例#4
0
        public ActionResult ShowConnectionString()
        {
            string cs =
                DataBasesManager.GetDbInfos(User.Identity.GetUserId())
                .OrderByDescending(db => db.DateOfCreating)
                .First()
                .ConnectionString;

            return(PartialView("ShowConnectionString", cs));
        }
示例#5
0
        /// <summary>
        /// Removes Database after confiramtion
        /// </summary>
        /// <returns></returns>
        public ActionResult DeleteConfirmed(int id)
        {
            //Find user
            AppUser user = _userManager.FindById(User.Identity.GetUserId());
            //Find DB
            DataBaseInfo foundDb = DataBasesManager.GetDbInfos(user.Id).Single(db => db.Id == id);

            //Remove db info from DbInfos
            DataBasesManager.RemoveDbInfo(foundDb);
            //Delete database
            DataService.DropDataBase(foundDb.DbmsType, foundDb.Name);

            return(RedirectToAction("Index"));
        }
示例#6
0
        public ActionResult QueryExecutor(QueryExecutorVm vm)
        {
            //Find user
            AppUser      user    = _userManager.FindById(User.Identity.GetUserId());
            DataBaseInfo foundDb = DataBasesManager.GetDbInfos(user.Id).Single(m => m.Id == vm.DbId);

            //TODO: Think, if i need different executors for each DBMS or not

            using (IQueryExecutor executor = new SqlServerExecutor(foundDb.ConnectionString))
            {
                vm.DataTable = executor.ExecuteQueryAsDataTable(vm.Query);
            }
            return(PartialView("QueryResults", vm.DataTable));
        }
示例#7
0
        public ActionResult ExecuteQuery(int id)
        {
            //Find user
            AppUser user = _userManager.FindById(User.Identity.GetUserId());
            //Find DB
            DataBaseInfo foundDb = DataBasesManager.GetDbInfos(user.Id).Single(db => db.Id == id);

            QueryExecutorVm vm = new QueryExecutorVm
            {
                DbId   = id,
                DbName = foundDb.Name
            };

            return(PartialView("~/Views/Query/QueryExecutor.cshtml", vm));
        }
示例#8
0
        public ActionResult Index()
        {
            AppUser user = _userManager.FindById(User.Identity.GetUserId());

            return(View(DataBasesManager.GetDbInfos(user.Id)));
        }