Example #1
0
        public ActionResult GetAllCategory()
        {
            dynamic category = 0;

            try
            {
                if (ModelState.IsValid)
                {
                    CategoryServiceClient categoryServiceClient = new CategoryServiceClient();
                    category = categoryServiceClient.GetAllCategory();
                    //if (category.Count == 0 || category == null)
                    //{
                    //    ModelState.AddModelError("error", "No Record Found");
                    //}
                }
            }
            catch (Exception e)
            {
                ModelState.AddModelError("error", "Something Wrong");
                category = null;
                throw e;
            }
            return(Json(category, JsonRequestBehavior.AllowGet));
        }