user7046806
user7046806

Reputation:

Trying to Move Cards

I am trying to move a card I have found using the search function from one list to another on the same board.

I have tried to set up a new list using the a new factory.list and searching for the list using FirstorDefault LINQ Query but keep getting an Error.

Below is some code I have tried to move my cards.

string query = jnum;
var search = factory.Search(query, 1, SearchModelType.Cards, new IQueryable[] { board });
await search.Refresh();
var CardList = search.Cards.ToList();

foreach (var card in CardList)
{
    string tName = card.Name.Substring(0, 6);

    if (tName == jnum.Trim())
    {
        cardid = card.Id;
    }
}

var FoundCard = factory.Card(cardid);
string FoundListid = FoundCard.List.Id;
var fromlist = factory.List(FoundListid);

if (Item != null)
{
    if (mail.Body.ToUpper().Contains("Approved for Print".ToUpper()))
    {
        //var ToList = factory.List("5db19603e4428377d77963b4");
        var ToList = board.Lists.FirstOrDefault(l => l.Name == "Signed Off");
        FoundCard.List = ToList;
        // from on proof                    
        //MessageBox.Show("Approved for Print");
    }
    else if (mail.Body.ToUpper().Contains("Awaiting Review".ToUpper()))
    {
        //var ToList = factory.List("5db19603e4428377d77963b3");
        var ToList = board.Lists.FirstOrDefault(l => l.Name == "On Proof");

        FoundCard.List = ToList;
        // from in progress or to start
        // MessageBox.Show("Awaiting Review");
     }
    else if (mail.Body.ToUpper().Contains("Amends".ToUpper()))
    {
        var ToList = factory.List("5dc9442eb245e60a39b3d4a7");
        FoundCard.List = ToList;
        // from on proof
        //MessageBox.Show("Amends");
    }
    else
    {
        // non job mail
    }

}

I keep getting a is not a valid value Error. Thanks for help

Upvotes: 1

Views: 86

Answers (0)

Related Questions