public async Task UpdateAsync(TaskStatusEntity entity) { using (var connection = _connectionManager.CreateConnection()) { var command = new SqlCommand("UpdateTaskStatus", connection); command.CommandType = CommandType.StoredProcedure; command.Parameters.AddWithValue("@Id", entity.Id); command.Parameters.AddWithValue("@Name", entity.Name); command.Parameters.AddWithValue("@Description", entity.Descrition); await connection.OpenAsync(); await command.ExecuteNonQueryAsync(); } }
public async Task <TaskStatusEntity> RetrieveByIdAsync(Guid id) { TaskStatusEntity resultTaskStatusEntity = null; using (var connection = _connectionManager.CreateConnection()) { var command = new SqlCommand("RetrieveProductOptionsById", connection) { CommandType = CommandType.StoredProcedure }; command.Parameters.AddWithValue("@Id", id); await connection.OpenAsync(); var reader = await command.ExecuteReaderAsync(); if (await reader.ReadAsync()) { resultTaskStatusEntity = ToTaskStatusEntity(reader); } } return(resultTaskStatusEntity); }
public async Task <TaskStatusEntity> CreateAsync(TaskStatusEntity entity) { using (var connection = _connectionManager.CreateConnection()) { var command = new SqlCommand("CreateTaskStatusEntity", connection) { CommandType = CommandType.StoredProcedure }; if (entity.Id != Guid.Empty) { command.Parameters.AddWithValue("@Id", entity.Id); } command.Parameters.AddWithValue("@Name", entity.Name); command.Parameters.AddWithValue("@Description", entity.Descrition); var id = await command.ExecuteScalarAsync(); entity.Id = Guid.Parse(id.ToString()); } return(entity); }