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));
            }
        }