コード例 #1
0
        public ActionResult detail(int id)
        {
            List <space>        pvm  = new List <space>();
            IEnumerable <space> prod = sp.GetMany(x => x.owner_id == id);

            foreach (var u in prod)
            {
                space G = new space

                {
                    id          = u.id,
                    name        = u.name,
                    description = u.description,
                    adress      = u.adress,
                    loulepar    = u.loulepar,
                    rentalPrice = u.rentalPrice,
                    pic         = u.pic,
                    owner_id    = u.owner_id,

                    user = us.GetById(id)
                };

                pvm.Add(G);
            }

            return(View(pvm));
        }
コード例 #2
0
        //public SpaceController()
        //{
        //    service = new SpaceService();
        //}
        // GET: Space
        public ActionResult Index()
        {
            IEnumerable <space>    ListSpace      = service.GetMany();
            IList <SpaceViewModel> ListSpaceModel = new List <SpaceViewModel>();

            foreach (space s in ListSpace)
            {
                SpaceViewModel svm = new SpaceViewModel();
                // svm.Id = s.id;
                svm.Adress      = s.adress;
                svm.Description = s.description;

                svm.Prix     = (int)s.rentalPrice;
                svm.Urlimage = s.pic;
                ListSpaceModel.Add(svm);
            }
            return(View(ListSpaceModel));
        }