public async Task <IEnumerable <LoginResponseDo> > UserRegister(string Vardas, string Pavarde, string Email, string Password)
        {
            SqlCommand sqlCom = new SqlCommand();

            sqlCom.CommandText = _regUSeris;

            var id = Guid.NewGuid();

            sqlCom.Parameters.AddWithValue("@email", Email);
            sqlCom.Parameters.AddWithValue("@id", id);
            sqlCom.Parameters.AddWithValue("@vardas", Vardas);
            sqlCom.Parameters.AddWithValue("@pavarde", Pavarde);
            sqlCom.Parameters.AddWithValue("@password", GetHash(sha256Hash, Password));

            await _sqlClient.newFunc(sqlCom);

            /*var insertQuery = string.Format(_regUSer, Email, id, Vardas, Pavarde, Email, GetHash(sha256Hash, Password));
             *
             * await _sqlClient.ExecuteNonQuery(insertQuery);*/
            var getAllQuery = string.Format(_getRegisteredUserInfo, id.ToString());

            var result = await _sqlClient.ExecuteQueryList <LoginResponseDto>(getAllQuery, FuncToGetDataForLogin);

            var resultTask = result.Select(d => new LoginResponseDo
            {
                Id          = new Guid(d.Id),
                Vardas      = d.Vardas,
                Pavarde     = d.Pavarde,
                Email       = d.Email,
                Pavadinimas = d.Pavadinimas
            });

            return(resultTask);
        }
示例#2
0
        public async Task <IEnumerable <Guid> > GetAll(Guid id)
        {
            var getAllQuery = string.Format(_getAllQueryString, id.ToString());

            var result = await _sqlClient.ExecuteQueryList <VartotojaiDto>(getAllQuery, Func);

            var resultTask = result.Select(d => new Guid(d.VartotojoId));

            return(resultTask);
        }
示例#3
0
        public async Task <IEnumerable <UserGetAcceptedTrainerListDo> > GetAll(Guid id)
        {
            var getAllQuery = string.Format(_getAllQueryString, id);

            var result = await _sqlClient.ExecuteQueryList <UserGetAcceptedTrainerListDto>(getAllQuery, Func);

            var resultTask = result.Select(d => new UserGetAcceptedTrainerListDo
            {
                Id      = new Guid(d.Id),
                Vardas  = d.Vardas,
                Pavarde = d.Pavarde,
                Email   = d.Email
            });

            return(resultTask);
        }
        public async Task <IEnumerable <StatistikaDo> > GetAll()
        {
            var getAllQuery = string.Format(_getAllQueryString);

            var result = await _sqlClient.ExecuteQueryList <StatistikaDto>(getAllQuery, Func);

            var resultTask = result.Select(d => new StatistikaDo
            {
                StatistikosId      = new Guid(d.StatistikosId),
                TreniruotesPradzia = DateTime.Parse(d.TreniruotesPradzia),
                TreniruotesPabaiga = DateTime.Parse(d.TreniruotesPabaiga),
                VartotojoId        = new Guid(d.VartotojoId)
            });

            return(resultTask);
        }
示例#5
0
        public async Task <IEnumerable <TreniruoteDo> > GetAll(Guid id)
        {
            var getAllQuery = string.Format(_getAllQueryString, id.ToString());

            var result = await _sqlClient.ExecuteQueryList <TreniruoteDto>(getAllQuery, Func);

            var resultTask = result.Select(d => new TreniruoteDo
            {
                TreniruotesId = new Guid(d.TreniruotesId),
                TrenerioId    = new Guid(d.TrenerioId),
                Pavadinimas   = d.Pavadinimas,
                Aprasymas     = d.Aprasymas,
                SukurimoData  = DateTime.Parse(d.SukurimoData)
            });

            return(resultTask);
        }
示例#6
0
        public async Task <IEnumerable <TrainerRequestsToFriendDo> > GetAll(Guid trenerioId)
        {
            var getAllQuery = string.Format(_getAllQueryString, trenerioId.ToString());

            var result = await _sqlClient.ExecuteQueryList <TrainerRequestsToFriendDto>(getAllQuery, Func);

            var resultTask = result.Select(d => new TrainerRequestsToFriendDo
            {
                KvietimoId   = new Guid(d.KvietimoId),
                TrenerioID   = new Guid(d.TrenerioID),
                VartotojoId  = new Guid(d.VartotojoId),
                SukurimoData = DateTime.Parse(d.SukurimoData),
                Vardas       = d.Vardas,
                Pavarde      = d.Pavarde
            });

            return(resultTask);
        }
示例#7
0
        public async Task <IEnumerable <PratymaiDo> > GetAll()
        {
            var getAllQuery = string.Format(_getAllQueryString);

            var result = await _sqlClient.ExecuteQueryList <PratymaiDto>(getAllQuery, Func);

            var resultTask = result.Select(d => new PratymaiDo
            {
                PratimoId   = new Guid(d.PratimoId),
                Pavadinimas = d.Pavadinimas
            });

            return(resultTask);
        }
示例#8
0
        public async Task <IEnumerable <PrasymaiPakeistRoleDo> > GetAll()
        {
            var getAllQuery = string.Format(_getAllQueryString);

            var result = await _sqlClient.ExecuteQueryList <PrasymaiPakeistRoleDto>(getAllQuery, Func);

            var resultTask = result.Select(d => new PrasymaiPakeistRoleDo
            {
                PakvietimoId = new Guid(d.PakvietimoId),
                SukurimoData = DateTime.Parse(d.SukurimoData),
                Vardas       = d.Vardas,
                Pavarde      = d.Pavarde
            });

            return(resultTask);
        }
        public async Task <IEnumerable <PratymuSksaiciusDo> > GetAll(Guid id)
        {
            var getAllQuery = string.Format(_getAllQueryString, id.ToString());

            var result = await _sqlClient.ExecuteQueryList <PratymuSkaiciusDto>(getAllQuery, Func);

            var resultTask = result.Select(d => new PratymuSksaiciusDo
            {
                TreniruotesId = new Guid(d.TreniruotesId),
                PratymoId     = new Guid(d.PratymoId),
                Priejimai     = Int32.Parse(d.Priejimai),
                Skaicius      = Int32.Parse(d.Skaicius),
                Pavadinimas   = d.Pavadinimas
            });

            return(resultTask);
        }