Beispiel #1
0
        public async Task <IActionResult> Update(InnovaUser innovaUser)
        {
            var result = await _innovaUserManager.UpdateUser(innovaUser);

            if (result.Success)
            {
                return(Ok());
            }
            else
            {
                return(BadRequest());
            }
        }
        public async Task <IResult> DeleteUser(InnovaUser innovaUser)
        {
            try
            {
                using (var connection = CreateConnection())
                {
                    var queryString = $"update TBLKULLANICI set AKTIF = 1 where ID ={innovaUser.Id} ";

                    var resultData = await connection.QueryAsync(queryString);

                    return(new SuccessResult());
                }
            }
            catch (Exception ex)
            {
                return(new ErrorResult("Hata : " + ex.Message));
            }
        }
        public async Task <IResult> AddUser(InnovaUser innovaUser)
        {
            try
            {
                using (var connection = CreateConnection())
                {
                    var queryString = $"INSERT INTO [dbo].[TBLKULLANICI]([KULLANICI],[SIFRE]]) " +
                                      $"VALUES ({innovaUser.Username},{innovaUser.Password})";

                    var resultData = await connection.QueryAsync(queryString);

                    return(new SuccessResult());
                }
            }
            catch (Exception ex)
            {
                return(new ErrorResult("Hata : " + ex.Message));
            }
        }
        public async Task <IResult> UpdateUser(InnovaUser innovaUser)
        {
            try
            {
                using (var connection = CreateConnection())
                {
                    var queryString = $"update TBLKULLANICI " +
                                      $"set KULLANICI = '{innovaUser.Username}', " +
                                      $"SIFRE='{innovaUser.Password}' " +
                                      $"where ID ={innovaUser.Id} ";

                    var resultData = await connection.QueryAsync(queryString);

                    return(new SuccessResult());
                }
            }
            catch (Exception ex)
            {
                return(new ErrorResult("Hata : " + ex.Message));
            }
        }