public static LogModel loginResult(string rsaPublic)
        {
            /*
             * need implement of aes key created and encrypted by rsa key "userKey"
             */
            string aesKey = CryptHelper.generateAESKey();

            Globals.global_AES_Key = aesKey;


            LogModel logModel = new LogModel
            {
                result    = true,
                publicKey = encodeKey(aesKey, rsaPublic)
            };

            return(logModel);
        }
        public static workoutModelList workoutsRessult(string _userName)
        {
            //connect to db
            db_appEntities db    = new db_appEntities();
            List <string>  names = db.workouts.Where(s => s.userName == _userName).Select(s => s.workoutName).ToList();

            for (int i = 0; i < names.Count; i++)
            {
                names[i] = CryptHelper.Encrypt(names[i]);
            }
            db.Dispose();
            workoutModelList workoutModel = new workoutModelList
            {
                result   = true,
                workouts = names
            };

            return(workoutModel);
        }
        public static taskModelList tasksRrssult(string _workoutName)
        {
            //connect to db
            db_appEntities db = new db_appEntities();

            List <string> names = db.tasks.Where(s => s.workoutName == _workoutName).Select(s => s.taskName).ToList();

            for (int i = 0; i < names.Count; i++)
            {
                names[i] = CryptHelper.Encrypt(names[i]);
            }
            db.Dispose();

            taskModelList taskModel = new taskModelList
            {
                result    = true,
                tasksList = names
            };

            return(taskModel);
        }
        public static UserProperty getUserPropertyResult(string _userName)
        {
            //connect to db
            db_appEntities db    = new db_appEntities();
            user           _user = db.users.Where(x => x.userName == _userName).SingleOrDefault();

            _user.firstName = CryptHelper.Encrypt(_user.firstName);
            _user.lastName  = CryptHelper.Encrypt(_user.lastName);
            _user.userName  = CryptHelper.Encrypt(_user.userName);
            _user.password  = CryptHelper.Encrypt(_user.password);

            db.Dispose();

            UserProperty userPropertyModel = new UserProperty
            {
                result       = true,
                userProperty = _user
            };

            return(userPropertyModel);
        }
        public static ItemTaskModel taskByNameResult(string _taskName)
        {
            //connect to db
            db_appEntities db    = new db_appEntities();
            task           _task = db.tasks.Where(x => x.taskName == _taskName).SingleOrDefault();

            _task.workoutName = CryptHelper.Encrypt(_task.workoutName);
            _task.taskName    = CryptHelper.Encrypt(_task.taskName);
            _task.description = CryptHelper.Encrypt(_task.description);
            _task.time        = CryptHelper.Encrypt(_task.time);
            _task.rev         = CryptHelper.Encrypt(_task.rev);

            db.Dispose();

            ItemTaskModel taskModel = new ItemTaskModel
            {
                result   = true,
                itemTask = _task
            };

            return(taskModel);
        }
        public static favoritesModelList favoriteslistRessult(string masterUserName)
        {
            //connect to db
            db_appEntities  db           = new db_appEntities();
            List <favorite> workoutsList = db.favorites.Where(s => s.masterUser == masterUserName).ToList();

            for (int i = 0; i < workoutsList.Count; i++)
            {
                workoutsList[i].masterUser  = CryptHelper.Encrypt(workoutsList[i].masterUser);
                workoutsList[i].userName    = CryptHelper.Encrypt(workoutsList[i].userName);
                workoutsList[i].workoutName = CryptHelper.Encrypt(workoutsList[i].workoutName);
            }
            db.Dispose();

            favoritesModelList favoritesModel = new favoritesModelList
            {
                result            = true,
                favoritesWorkouts = workoutsList
            };

            return(favoritesModel);
        }
        public static storageModelList storagelistRessult()
        {
            //connect to db
            db_appEntities db          = new db_appEntities();
            List <workout> storageList = db.workouts.Where(s => s.inStorage == true).ToList();

            for (int i = 0; i < storageList.Count; i++)
            {
                storageList[i].userName    = CryptHelper.Encrypt(storageList[i].userName);
                storageList[i].workoutName = CryptHelper.Encrypt(storageList[i].workoutName);
                storageList[i].inStorage   = storageList[i].inStorage;
            }
            db.Dispose();

            storageModelList storageModel = new storageModelList
            {
                result          = true,
                storageWorkouts = storageList
            };

            return(storageModel);
        }