//Method for mapping from DO to PO public static WinsPO WinsDOtoPO(WinsDO from) { //Declaring a new PO object using the WinsPO model WinsPO to = new WinsPO(); //Mapping all relevant information. from is the pass in, to is the result. to.Winner = from.Winner; to.Wins = from.Wins; //sends the data back to the method that called it return(to); }
//Method for assigning data from database values to c# values public static WinsDO RowToItem(DataRow iSource) { //Establishing a object using model WinsDO WinsDO to = new WinsDO(); //Checking if SQL value is null or not, and if not, proceeds into the if if (iSource["Winner"] != DBNull.Value) { //pulling "Value" from SQL, casting it or converting it as necessary, and assigning it to it's c# equivalent to.Winner = iSource["Winner"].ToString(); } //Checking if SQL value is null or not, and if not, proceeds into the if if (iSource["NumberOfWins"] != DBNull.Value) { //pulling "Value" from SQL, casting it or converting it as necessary, and assigning it to it's c# equivalent to.Wins = (int)iSource["NumberOfWins"]; } //Return all data to previous method return(to); }