Пример #1
0
        public CategoryController()
        {
            var categoryRepository = RepositoryFactory.GetCategoryRepository();
            var propertyRepository = RepositoryFactory.GetPropertyRepository();
            var transactionRepository = RepositoryFactory.GetTransactionRepository();

            _categoryApp = new CategoryApp(categoryRepository, propertyRepository, transactionRepository);
        }
Пример #2
0
        public ActionResult SaveCategory(CategoryDto categoryDto)
        {
            var login = Request.Headers["login"];
            var token = Request.Headers["token"];
            var propertyId = Convert.ToInt32(Request.Headers["propertyId"]);

            if (!ValidatePost(login, token, propertyId))
                return Json("usuário inválido", JsonRequestBehavior.AllowGet);

            var categoryApp = new CategoryApp(_categoryRepository, _propertyRepository, _transactionRepository);
            categoryApp.Save(propertyId, categoryDto);

            return Json("OK");
        }