Exemplo n.º 1
0
 public async Task <IActionResult> GetAll()
 {
     try
     {
         return(Ok(await facade.GetAll()));
     }
     catch (Exception ex)
     {
         return(BadRequest(ex));
     }
 }
Exemplo n.º 2
0
        public ActionResult Index()
        {
            CategoryFacade   categoryFacade = new CategoryFacade();
            IndexModel       model          = new IndexModel();
            CategoryLanguage categoryLanguage;

            foreach (var category in categoryFacade.GetAll((int)CurrentLanguage.LanguageId))
            {
                categoryLanguage = category.CategoryLanguage.FirstOrDefault();
                model.Categories.Add(new CategoryModel
                {
                    CategoryId  = category.CategoryId,
                    LanguageId  = categoryLanguage.LanguageId,
                    Image       = category.Image,
                    Name        = categoryLanguage.Name,
                    Description = categoryLanguage.Description
                });
            }

            model.UserPrincipal   = CustomUser;
            model.CurrentLanguage = CurrentLanguage;

            return(View(model));
        }
Exemplo n.º 3
0
        public async Task <IActionResult> Index()
        {
            var items = await _categoryFacade.GetAll();

            return(View(items));
        }
Exemplo n.º 4
0
 public async Task <IActionResult> Create()
 {
     ViewBag.Category = new SelectList(await _categoryFacade.GetAll(), "Id", "Name");
     ViewBag.Domain   = _configuration["Domain"];
     return(View());
 }
Exemplo n.º 5
0
        public void GetAll()
        {
            var isValid = facade.GetAll();

            Assert.Equal(true, isValid.Result.IsSuccess);
        }
Exemplo n.º 6
0
 public ActionResult <List <CategoryListModel> > GetAll()
 {
     return(categoryFacade.GetAll().ToList());
 }