Esempio n. 1
0
        public IActionResult Create()
        {
            ProductCreateViewModel product = new ProductCreateViewModel();

            product.CatagoryItem = catagoryManager.GetAll()
                                   .Select(c => new SelectListItem()
            {
                Text  = c.Name,
                Value = c.Id.ToString()
            }).ToList();
            return(View(product));
        }
Esempio n. 2
0
        // GET: Post
        public ActionResult Index()
        {
            var allPost = _postManager.GetAll();
            var allCat  = _catagoryManager.GetAll();

            List <Post> postList = new List <Post>();

            foreach (var post in allPost)
            {
                var postVM = new Post
                {
                    Id       = post.Id,
                    Title    = post.Title,
                    Details  = post.Details,
                    Tags     = post.Tags,
                    Catagory = allCat.Where(x => x.Id == post.CatagoryId).FirstOrDefault()
                };
                postList.Add(postVM);
            }
            return(View(postList));
            //return Json(new {data = postList}, JsonRequestBehavior.AllowGet);
        }
        // GET: Catagory
        public ActionResult Index()
        {
            var Catagories = _manager.GetAll();

            return(View(Catagories));
        }
Esempio n. 4
0
        public IActionResult List()
        {
            ICollection <Catagory> catagories = _catagoryManager.GetAll();

            return(View(catagories));
        }