Exemple #1
0
        public object SearchDoc(ProfileViewModel profileViewModel)
        {
            if (!ModelState.IsValid)
            {
                // ...
                //return RedirectToAction(nameof(Index));
                View("Index");
            }

            ProfileViewModel.Totaldoccount = homeBusiness.GetSearchDocCountService(profileViewModel);

            if (ProfileViewModel.Totaldoccount > 0)
            {
                ProfileViewModel.pager.UpdatePager(ProfileViewModel.Totaldoccount, ProfileViewModel.pager.PageIndex, 10);

                List <ProfileViewModel> doclist = new List <ProfileViewModel>();

                var docData = homeBusiness.SearchDocService(profileViewModel, 1);

                foreach (DataRow dr in docData.Tables[0].Rows)                // loop for adding add from dataset to list<modeldata>
                {
                    doclist.Add(new ProfileViewModel
                    {
                        // adding data from dataset row in to list<modeldata>
                        Queryuname     = dr["username"].ToString(),
                        doc_Fname      = dr["doc_Fname"].ToString(),
                        doc_Lname      = dr["doc_Lname"].ToString(),
                        doc_Degree     = dr["doc_GradDegree"].ToString(),
                        doc_PostDegree = dr["doc_PostGrad"].ToString(),
                        doc_Phone      = dr["doc_Phone"].ToString(),
                        doc_Clinicname = dr["doc_Clinicname"].ToString(),
                    });;;
                }

                TempData["docdata"] = doclist;
            }

            return(View("Index"));
        }