コード例 #1
0
        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);
        }
コード例 #2
0
        public PhotoEntryModel GetDetails(int photoId)
        {
            PhotoEntryModel model = null;

            SQLConnector.Retrieve(x =>
            {
                x.CommandText = "dbo.Get_Image_Details_By_Id";
                x.Parameters.AddWithValue("@ImageId", photoId);
            },
                                  (DataRow dr) => {
                model             = new PhotoEntryModel();
                model.PhotoId     = dr.Field <int>("Id");
                model.Base64      = dr.Field <String>("Base64Image");
                model.UploadDate  = dr.Field <DateTime>("UploadDateTime");
                model.VisitorName = dr.Field <String>("VisitorName");
            });

            return(model);
        }