Exemple #1
0
        public ViewResult GetCategories()
        {
            var service = ServicesFactory.GetCategoriesService();
            var model   = service.GetCategoriesModel();

            return(View(model));
        }
Exemple #2
0
        public JsonResult DeleteCategory(int id)
        {
            string status  = string.Empty;
            var    service = ServicesFactory.GetCategoriesService();

            if (service.DeleteCategory(id))
            {
                status = "ok";
            }
            else
            {
                status = "fail";
            }

            return(Json(new { status = status }));
        }
Exemple #3
0
        public JsonResult AddCategory(string nameCategory)
        {
            string status  = string.Empty;
            var    service = ServicesFactory.GetCategoriesService();
            int    id      = service.AddCategory(nameCategory);

            if (!id.Equals(-1))
            {
                status = "ok";
            }
            else
            {
                status = "false";
            }
            return(Json(new { id = id, status = status }));
        }