Exemplo n.º 1
0
        // GET: Categories
        public ActionResult Index([FromQuery] CategorySearch categorySearch)
        {
            categorySearch.PageNumber = 0;
            var categories = _searchCategoriesCommand.Execute(categorySearch);

            return(View(categories.Data));
        }
 // GET: Products/Create
 public ActionResult Create()
 {
     ViewBag.Manufacturers = new SelectList(_getManufacturers.Execute(), "ManufacturerId", "Name");
     ViewBag.Categories    = new SelectList(_getCategories.Execute(), "CategoryId", "Name");
     ViewBag.Suppliers     = new SelectList(_getSuppliers.Execute(), "SupplierId", "Name");
     return(View());
 }
Exemplo n.º 3
0
        // GET: Categories
        public ActionResult Index(string sortOrder, string searchString, CategoryQuery query)
        {
            ViewBag.CategorySortParam = String.IsNullOrEmpty(sortOrder) ? "category_desc" : "";
            ViewBag.CurrentSortOrder  = sortOrder;
            ViewBag.CurrentFilter     = searchString;

            var categoryList = _getCategories.Execute(query);

            return(View(categoryList));
        }
Exemplo n.º 4
0
 public ActionResult <IEnumerable <CategoryDto> > Get([FromQuery] CategoryQuery query)
 {
     try
     {
         return(Ok(_getCategories.Execute(query)));
     }
     catch (NotFoundException)
     {
         return(NotFound());
     }
 }
Exemplo n.º 5
0
 public IActionResult Get(int id)
 {
     try
     {
         var search = new NameSearch
         {
             Id = id
         };
         var result = _getCategories.Execute(search);
         return(Ok(result.First()));
     }
     catch (EntityNotFoundException e)
     {
         return(NotFound(e.Message));
     }
     catch (Exception e)
     {
         return(StatusCode(500, e.Message));
     }
 }
Exemplo n.º 6
0
 public IActionResult GetAll([FromQuery] CategorySearch request)
 {
     try
     {
         var response = _getCategoriesCommand.Execute(request);
         return(Ok(response));
     }
     catch (Exception ex)
     {
         return(StatusCode(500, ex.Message));
     }
 }
Exemplo n.º 7
0
 public IActionResult Get([FromQuery] CategorySearch search)
 {
     try
     {
         var dto = _getCategoriesCommand.Execute(search);
         return(Ok(dto));
     }
     catch (EntityNotFoundException)
     {
         return(Conflict("There's no data for your request."));
     }
 }
Exemplo n.º 8
0
 // GET: Cars/Create
 public ActionResult Create()
 {
     ViewBag.Categories = _getCategoriesCommand.Execute(new CategorySearch {
     });
     ViewBag.Types      = _getTypesCommand.Execute(new TypeSearch {
     });
     ViewBag.Fuels      = _getFuelsCommand.Execute(new FuelSearch {
     });
     ViewBag.Models     = _getModelsCommand.Execute(new ModelSearch {
     });
     ViewBag.Brands     = _getBrandsCommand.Execute(new BrandSearch {
     });
     return(View());
 }
Exemplo n.º 9
0
 public IActionResult Get([FromQuery] CategorySearch search)
 {
     try
     {
         var kategorija = _getCategoriesCommand.Execute(search);
         return(Ok(kategorija));
     }
     catch (EntityNotFoundException e)
     {
         if (e.Message == "Kategorija doesn't exist.")
         {
             return(NotFound(e.Message));
         }
         return(UnprocessableEntity(e.Message));
     }
 }
Exemplo n.º 10
0
        public IActionResult Index([FromQuery] ArticleSearch articleSearch, CategorySearch categorySearch)
        {
            articleSearch.PageNumber = 0;
            var articles = _searchArticlesCommand.Execute(articleSearch);

            categorySearch.PageNumber = 0;
            var categories = _searchCategoriesCommand.Execute(categorySearch);

            var viewModel = new HomeViewModel
            {
                Articles   = articles.Data,
                Categories = categories.Data
            };

            return(View(viewModel));
        }
Exemplo n.º 11
0
 public ActionResult Get([FromQuery] CategorySearch search)
 => Ok(getCategoriesCommand.Execute(search));
Exemplo n.º 12
0
 public IActionResult Get([FromQuery] CategoryQuery query)
 {
     return(Ok(_getCommand.Execute(query)));
 }
Exemplo n.º 13
0
 public ActionResult <PagedResponse <CategoryDto> > Get([FromQuery] CategorySearch categorySearch)
 => Ok(_searchCategoriesCommand.Execute(categorySearch));
Exemplo n.º 14
0
 //[LoggedIn("Admin")]
 // GET: News/Create
 public ActionResult Create()
 {
     ViewBag.Categories = _getCategoriesCommand.Execute(null);
     return(View());
 }
 public ActionResult <IEnumerable <CategoryDTO> > Get([FromQuery] CategorySearch query)
 {
     return(Ok(_getCommand.Execute(query)));
 }
Exemplo n.º 16
0
 //[ClaimRequirement(_user.RoleName, "Admin")]
 // GET: News/Create
 public ActionResult Create()
 {
     ViewBag.Korisnik   = HttpContext.Session.GetString("User");
     ViewBag.Categories = _getCategoriesCommand.Execute(null);
     return(View());
 }
Exemplo n.º 17
0
        // GET: Category
        public ActionResult Index(CategoryQuery search)
        {
            var categories = _getCommand.Execute(search);

            return(View(categories));
        }
Exemplo n.º 18
0
 private IEnumerable GetCategories(CategorySearch search)
 {
     return(_categoryCommand.Execute(search));
 }
Exemplo n.º 19
0
 public IActionResult Get([FromQuery] CategorySearch query)
 => Ok(_getCommand.Execute(query));
Exemplo n.º 20
0
        // GET: Categories
        public ActionResult Index(CategorySearch search)
        {
            var result = _getCommand.Execute(search);

            return(View(result));
        }
        public ActionResult <IEnumerable <CategoryDto> > Get([FromQuery] CategorySearch search)
        {
            var categories = _getCommand.Execute(search);

            return(Ok(categories));
        }
 public IActionResult Get([FromQuery] CategoriesSearch query)
 {
     return(Ok(_getCommands.Execute(query)));
 }
Exemplo n.º 23
0
        public ActionResult Index(CategorySearch model)
        {
            var response = _listCategoryCommand.Execute(model);

            return(View(response));
        }