public void Update(Story story) { try { using (MySqlConnection connection = OpenNewConnection()) { MySqlCommand command = new MySqlCommand(); command.CommandText = $"UPDATE `{_STORIES_TABLE_NAME}` SET " + "Name = @Name, " + "Importance = @Importance, " + "InitialEstimate = @InitialEstimate, " + "HowToDemo = @HowToDemo, " + "Notes = @Notes, " + "Status = @StatusId, " + "ExecutorId = @ExecutorId " + "WHERE Id = @Id;"; command.Connection = connection; uint statusId = _storyStatusesDataModel.GetIdOfStatus(story.Status); command.Parameters.Add(new MySqlParameter("@Name", story.Name)); command.Parameters.Add(new MySqlParameter("@Importance", story.Importance)); command.Parameters.Add(new MySqlParameter("@InitialEstimate", (story.InitialEstimate == default(uint)) ? (object)DBNull.Value : story.InitialEstimate)); command.Parameters.Add(new MySqlParameter("@HowToDemo", story.HowToDemo)); command.Parameters.Add(new MySqlParameter("@Notes", story.Notes)); command.Parameters.Add(new MySqlParameter("@StatusId", statusId)); command.Parameters.Add(new MySqlParameter("@ExecutorId", (story.ExecutorId == default(uint)) ? (object)DBNull.Value : story.ExecutorId)); command.Parameters.Add(new MySqlParameter("@Id", story.Id)); command.ExecuteNonQuery(); StoryUpdated?.Invoke(this, story); } } catch (Exception ex) { _logger?.Fatal(ex); throw; } }
public void When(StoryUpdated storyUpdated) { }