PhotoEntity.Controllers.Manager.PropertyPhotoGetById C# (CSharp) Method

PropertyPhotoGetById() public method

public PropertyPhotoGetById ( string stringId ) : PhotoContent
stringId string
return PhotoContent
        public PhotoContent PropertyPhotoGetById(string stringId)
        {
            var o = ds.Photos.SingleOrDefault(p => p.StringId == stringId);

            return (o == null) ? null : Mapper.Map<PhotoContent>(o);
        }

Usage Example

コード例 #1
0
        public ActionResult Details(string stringId = "")
        {
            // Attempt to get the matching object
            var o = m.PropertyPhotoGetById(stringId);

            if (o == null)
            {
                return(HttpNotFound());
            }
            else
            {
                // Return a file content result
                // Set the Content-Type header, and return the photo bytes
                return(File(o.Content, o.ContentType));
            }
        }