Exemplo n.º 1
0
        public ActionResult Index()
        {
            var fishCollection = this.fishService.GetAll();
            var model          = new FishListViewModel()
            {
                FishCollection = fishCollection
            };

            return(View(model));
        }
Exemplo n.º 2
0
        public ActionResult Details(string name)
        {
            var fish  = this.fishService.GetFishByName(name);
            var model = new FishListViewModel()
            {
                SelectedFish = fish
            };

            return(View(model));
        }
Exemplo n.º 3
0
        public ActionResult Index()
        {
            var fishListModel = new FishListViewModel();

            if (Session["CurrentUserId"] != null)
            {
                var userId = (int)Session["CurrentUserId"];
                fishListModel.Fishes = fishRepository.GetFishesByUserId(userId).ToList();
            }

            return(View(fishListModel));
        }
Exemplo n.º 4
0
        public IActionResult ChoosenFish(string id)
        {
            FishListViewModel obj = new FishListViewModel();
            var data = db.fish.AsNoTracking().ToList();

            obj.currCategory = _allCategories.AllCategories;
            List <FishViewModel> res = new List <FishViewModel>();

            for (int i = 0; i < data.Count; i++)
            {
                for (int j = 1; j < obj.currCategory.ToList().Count + 1; j++)
                {
                    if (data[i].categoryID == Convert.ToInt32(id))
                    {
                        res.Add(data[i]);
                        break;
                    }
                }
            }
            return(View(res));
        }