AssocAddEdit.Controllers.Manager.ManufacturerGetByIdWithDetail C# (CSharp) Метод

ManufacturerGetByIdWithDetail() публичный Метод

public ManufacturerGetByIdWithDetail ( int id ) : ManufacturerWithDetail
id int
Результат ManufacturerWithDetail
        public ManufacturerWithDetail ManufacturerGetByIdWithDetail(int id)
        {
            var o = ds.Manufacturers.Include("Country").Include("Vehicles")
                .SingleOrDefault(m => m.Id == id);

            return Mapper.Map<ManufacturerWithDetail>(o);
        }

Usage Example

Пример #1
0
        // GET: Manufacturers/Details/5
        public ActionResult Details(int?id)
        {
            // Attempt to get the matching object
            var o = m.ManufacturerGetByIdWithDetail(id.GetValueOrDefault());

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