public static IEnumerable <PropertyPassItemDbTable> ConvertListToDb(PropertyPassDbTable PropertyPassTable, List <AssetDisplayClass> AssetList) { var List = new List <PropertyPassItemDbTable>(); foreach (AssetDisplayClass Asset in AssetList) { var JsonObj = JsonConvert.DeserializeObject <AssetJsonObject>(Asset.AssetJSONDb); var _PPI = new PropertyPassItemDbTable { Asset_ID_Internal = Asset.AssetIdInternal, Assigned_By = PropertyPassTable.Assigned_By, CheckOutDate = DateTime.Now.ToString(), DueDate = PropertyPassTable.DueDate, PropertyPassID_Internal = PropertyPassTable.PropertyPassID_Internal, ModifiedOn = DateTime.Now.ToString(), SiteIDInternal = JsonObj.SiteIDInternal, Quantity = Asset.Quantity, PropertyPassItemID_Internal = GUID.Generate(), AssetSerialNo = JsonObj.AssetSerialNo, CheckInDate = null, Synced = true, }; List.Add(_PPI); } return(List); }
public PropertyPassItem(PropertyPassItemDbTable PropertyPassItemDb = null) { Asset_ID_Internal = PropertyPassItemDb.Asset_ID_Internal; AssetSerialNo = PropertyPassItemDb.AssetSerialNo; Assigned_By = PropertyPassItemDb.Assigned_By; CheckInDate = Convert.ToDateTime(PropertyPassItemDb.CheckInDate); CheckOutDate = Convert.ToDateTime(PropertyPassItemDb.CheckOutDate); DueDate = Convert.ToDateTime(PropertyPassItemDb.DueDate); PropertyPassID_Internal = PropertyPassItemDb.PropertyPassID_Internal; PropertyPassItemID_Internal = PropertyPassItemDb.PropertyPassItemID_Internal; Quantity = PropertyPassItemDb.Quantity; SiteIDInternal = PropertyPassItemDb.SiteIDInternal; ModifiedOn = Convert.ToDateTime(PropertyPassItemDb.ModifiedOn); }