public IEnumerable <FriendPhotoEntryModel> GetFriends(int userId) { List <FriendPhotoEntryModel> list = new List <FriendPhotoEntryModel>(); SQLConnector.RetrieveMultiple(x => { x.CommandText = "dbo.Select_User_Friends_By_UserId"; x.Parameters.AddWithValue("@UserId", userId); }, (DataTable dt) => { if (dt != null) { foreach (DataRow dr in dt.Rows) { FriendPhotoEntryModel model = new FriendPhotoEntryModel { FriendId = dr.Field <int>("Id"), FriendName = dr.Field <String>("FriendName"), ImageBase64 = dr.Field <String>("FriendBase64Image"), UserId = dr.Field <int>("UserId"), ImageExtension = dr.Field <string>("Extension") }; list.Add(model); } } }); return(list); }
public IEnumerable <PhotoEntryModel> GetRecent(int userId) { List <PhotoEntryModel> list = new List <PhotoEntryModel>(); SQLConnector.RetrieveMultiple(x => { x.CommandText = "dbo.Select_Recent_Visitors"; x.Parameters.AddWithValue("@UserId", userId); }, (DataTable dt) => { if (dt != null) { foreach (DataRow dr in dt.Rows) { var model = new PhotoEntryModel { UploadDate = dr.Field <DateTime>("UploadDateTime"), PhotoId = dr.Field <int>("Id"), VisitorName = dr.Field <String>("FriendName") }; list.Add(model); } } }); return(list); }