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

PropertyGetByIdWithPhotoInfo() public method

public PropertyGetByIdWithPhotoInfo ( int id ) : PropertyWithPhotoStringIds
id int
return PropertyWithPhotoStringIds
        public PropertyWithPhotoStringIds PropertyGetByIdWithPhotoInfo(int id)
        {
            var o = ds.Properties.Include("Photos").SingleOrDefault(p => p.Id == id);

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

Usage Example

コード例 #1
0
        // GET: Properties/DetailsWithPhotoInfo/5
        public ActionResult DetailsWithPhotoInfo(int?id)
        {
            // Attempt to get the matching object
            var o = m.PropertyGetByIdWithPhotoInfo(id.GetValueOrDefault());

            if (o == null)
            {
                return(HttpNotFound());
            }
            else
            {
                // Pass the object to the view
                return(View(o));
            }
        }