Exemplo n.º 1
0
        public async Task <IActionResult> InsertOneToOneAsync()
        {
            var dt = new GroupOneToOneDTO
            {
                NAME  = "One To One 1",
                USERS = new UserOneDTO {
                    FiRST_NAME = "Eyüp One To One 1", LAST_NAME = "Ensar", EMAiL = "*****@*****.**", PASSWORD = "******", PHONE = "05550000000", GROUPiD = 1, USERTYPEiD = 1
                },
            };
            var rs = await _userService.InsertOneToOneAsync(dt);

            return(View());
        }
Exemplo n.º 2
0
        public async Task <bool> DeleteOneToOneAsync(GroupOneToOneDTO dt)
        {
            bool result = false;

            using (var transaction = _connection.DB.BeginTransaction())
            {
                try
                {
                    await _connection.DB.ExecuteAsync(@"DELETE FROM USER_GROUPS WHERE ID = @GROUPiD", dt, transaction);

                    await _connection.DB.ExecuteAsync(@"DELETE FROM USERS WHERE GROUPID = @GROUPiD AND ID = @UseriD", dt.USERS, transaction);

                    transaction.Commit();
                    result = true;
                }
                catch
                {
                    transaction.Rollback();
                }
            }
            return(result);
        }
Exemplo n.º 3
0
        public async Task <bool> UpdateOneToOneAsync(GroupOneToOneDTO dt)
        {
            bool result = false;

            using (var transaction = _connection.DB.BeginTransaction())
            {
                try
                {
                    await _connection.DB.ExecuteAsync(@"UPDATE USER_GROUPS SET NAME= @NAME WHERE ID = @GROUPiD", dt, transaction);

                    await _connection.DB.ExecuteAsync(@"UPDATE USERS SET FIRST_NAME= @FiRST_NAME WHERE GROUPID = @GROUPiD AND ID = @UseriD", dt.USERS, transaction);

                    transaction.Commit();
                    result = true;
                }
                catch
                {
                    transaction.Rollback();
                }
            }
            return(result);
        }
Exemplo n.º 4
0
        public async Task <bool> InsertOneToOneAsync(GroupOneToOneDTO dt)
        {
            bool result = false;

            using (var transaction = _connection.DB.BeginTransaction())
            {
                try
                {
                    dt.USERS.GROUPiD = await _connection.DB.ExecuteScalarAsync <int>(@"INSERT USER_GROUPS(NAME) values(@NAME) select SCOPE_IDENTITY()", dt, transaction);

                    await _connection.DB.ExecuteAsync(@"INSERT USERS(USERTYPEID,GROUPID,FIRST_NAME,LAST_NAME,EMAIL,PASSWORD,PHONE) values(@USERTYPEiD,@GROUPiD,@FiRST_NAME,@LAST_NAME,@EMAiL,@PASSWORD,@PHONE); select SCOPE_IDENTITY();", dt.USERS, transaction);

                    transaction.Commit();
                    result = true;
                }
                catch
                {
                    transaction.Rollback();
                }
            }
            return(result);
        }
Exemplo n.º 5
0
 public async Task <bool> InsertOneToOneAsync(GroupOneToOneDTO dt)
 {
     return(await _dapperUserDAL.InsertOneToOneAsync(dt));
 }
Exemplo n.º 6
0
 public Task <bool> DeleteOneToOneAsync(GroupOneToOneDTO dt)
 {
     throw new NotImplementedException();
 }