Skip to content

Instantly share code, notes, and snippets.

@hbulens
Last active January 13, 2018 04:27
Show Gist options
  • Save hbulens/dbb7ded29ed4b1e8264eed40b51da920 to your computer and use it in GitHub Desktop.
Save hbulens/dbb7ded29ed4b1e8264eed40b51da920 to your computer and use it in GitHub Desktop.
public static Country ConvertToCountry(sp.SPListItem item)
{
  Country newCountry = new Country();
  try
  {
    if (item != null)
    {
      newCountry.Id = int.Parse(item[Resources.Fields_Id].ToString());
      newCountry.Title = item.Fields.ContainsField(Resources.Fields_Title1) && item[Resources.Fields_Title1] != null ? item[Resources.Fields_Title1].ToString() : string.Empty;
      newCountry.BusinessUnit = item.Fields.ContainsField(Resources.Fields_Title) && item[Resources.Fields_Title] != null ? item[Resources.Fields_Title].ToString() : string.Empty;
    }
  }
  catch
  {
    throw;
  }
  return newCountry;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment