public async Task <IActionResult> ShowDetail(int id)
        {
            var medical = await imedicalsResponsitory.GetById(id);

            ViewBag.hospitals = ihospitalsResponsitory.GetAll().OrderBy(p => p.HospitalName).ToList();
            ViewBag.companies = icompanyDetailsResponsitory.GetAll().OrderBy(p => p.CompanyName).ToList();
            return(View("detail", medical));
        }
 public IActionResult Index()
 {
     ViewBag.pageTitle = "Hospital List";
     ViewBag.hospitals = ihospitalRepository.GetAll().ToList();
     return(View());
 }
        public IActionResult ShowData(int fromNum, int limitNum, string searchData)
        {
            var hospitals           = new List <Hospitals>();
            var hospitalsGetAllData = new List <Hospitals>();

            if (searchData != "" && searchData != null)
            {
                hospitalsGetAllData = ihospitalsResponsitory.GetAllWithoutTracking().Where(p => p.HospitalName.Contains(searchData)).ToList();
                hospitals           = ihospitalsResponsitory.GetAll().OrderBy(p => p.HospitalName).Where(p => p.HospitalName.Contains(searchData)).Skip(fromNum).Take(limitNum).ToList();
            }
            else
            {
                hospitalsGetAllData = ihospitalsResponsitory.GetAllWithoutTracking().ToList();
                hospitals           = ihospitalsResponsitory.GetAll().OrderBy(p => p.HospitalName).Skip(fromNum).Take(limitNum).ToList();
            }
            var html  = "";
            var count = 0;

            foreach (var hopspital in hospitals)
            {
                count++;
                var colorBackground = "";
                if (count % 2 == 0)
                {
                    colorBackground = "style='background-color:#7bedd1'";
                }
                html += "<tr class='tr-shadow' " + colorBackground + ">" +
                        "<td>" + count + "</td>" +
                        "<td>" + hopspital.HospitalName + "</td>" +
                        "<td>" + hopspital.Location + "</td>" +
                        "<td>" + hopspital.Phone + "</td>" +
                        "<td><a href='" + hopspital.HospitalUrl + "'>" + hopspital.HospitalUrl + "</a></td>" +
                        "<td>" +
                        "<a href='#' onclick='getDetail(" + hopspital.Id.ToString() + ")' style='font-weight:bold'>More Details</a>" +
                        " | <a href='#' onclick='deleteFunction(" + hopspital.Id.ToString() + ")' style='font-weight:bold; color:red'>Delete</a>" +
                        "</td></tr>";
                if (count < hospitals.Count())
                {
                    html += "</tr><tr class='spacer'></tr>";
                }
            }

            var totalPage = 0;

            if (hospitalsGetAllData.Count() % 5 == 0)
            {
                totalPage = hospitalsGetAllData.Count() / 5;
            }
            else
            {
                totalPage = (hospitalsGetAllData.Count() / 5) + 1;
            }
            if (totalPage == 0)
            {
                totalPage = 1;
            }
            return(Json(new[] { new
                                {
                                    status = true,
                                    data = html,
                                    pageTotal = totalPage
                                } }));
        }