Beispiel #1
0
        public ActionResult SubCategory()
        {
            List <SubCategory> SubCategoryList = new List <SubCategory>();
            Property           p  = new Property();
            DataSet            ds = new DataSet();

            p.OnTable = "FetchPathologySubCategory";

            ds = dl.FetchPathologySubCategory_sp(p);

            List <SelectListItem> CategoryList = new List <SelectListItem>();

            CategoryList.Add(new SelectListItem {
                Text = "Select Category", Value = ""
            });
            foreach (DataRow dr in ds.Tables[1].Rows)
            {
                CategoryList.Add(new SelectListItem {
                    Text = dr["CategoryName"].ToString(), Value = dr["CategoryId"].ToString()
                });
            }
            ViewBag.CategoryList = new SelectList(CategoryList, "Value", "Text");

            try
            {
                foreach (DataRow item in ds.Tables[0].Rows)
                {
                    SubCategory m = new SubCategory();

                    m.SubCategoryId   = item["SubCategoryId"].ToString();
                    m.CategoryId      = item["CategoryId"].ToString();
                    m.SubCategoryName = item["SubCategoryName"].ToString();
                    m.CategoryName    = item["CategoryName"].ToString();
                    m.HospitalId      = item["HospitalId"].ToString();
                    m.IsActive        = item["IsActive"].ToString();
                    SubCategoryList.Add(m);
                }
                ViewBag.SubCategoryList = SubCategoryList;
            }
            catch (Exception e)
            {
            }
            return(View());
        }