示例#1
0
        public IActionResult Profile(BookViewModel bookViewModel)
        {
            var     profileData = homeBusiness.GetBookProfileService(bookViewModel);
            DataRow dr          = profileData.Tables[0].Rows[0];

            if (profileData.Tables[0].Rows.Count > 0)
            {
                BookViewModel.doc_userid       = (int)dr["userid"];
                bookViewModel.doc_username     = dr["username"].ToString();
                BookViewModel.username         = bookViewModel.doc_username; //giving value to static variable because doc_username becomes null as it does not have any field in cshtml
                bookViewModel.doc_Fname        = dr["doc_Fname"].ToString();
                bookViewModel.doc_Mname        = dr["doc_Mname"].ToString();
                bookViewModel.doc_Lname        = dr["doc_Lname"].ToString();
                bookViewModel.doc_Gender       = dr["doc_Gender"].ToString();
                bookViewModel.doc_DOB          = DateTime.Parse(dr["doc_DOB"].ToString());
                bookViewModel.doc_Degree       = dr["doc_GradDegree"].ToString();
                bookViewModel.doc_PostDegree   = dr["doc_PostGrad"].ToString();
                bookViewModel.doc_Phone        = dr["doc_Phone"].ToString();
                bookViewModel.doc_Email        = dr["doc_Email"].ToString();
                bookViewModel.doc_Clinicname   = dr["doc_Clinicname"].ToString();
                bookViewModel.doc_Address1     = dr["clinic_address1"].ToString();
                bookViewModel.doc_Address2     = dr["clinic_address2"].ToString();
                bookViewModel.doc_City         = dr["clinic_city"].ToString();
                bookViewModel.doc_State        = dr["clinic_state"].ToString();
                bookViewModel.doc_Pincode      = dr["clinic_pincode"].ToString();
                bookViewModel.doc_ClinicsPhone = dr["clinic_phone"].ToString();
                bookViewModel.doc_Services     = dr["doc_Services"].ToString();

                bookViewModel.from1 = dr["F1"] == DBNull.Value ? (TimeSpan?)null : TimeSpan.Parse(dr["F1"].ToString());
                bookViewModel.to1   = dr["T1"] == DBNull.Value ? (TimeSpan?)null : TimeSpan.Parse(dr["T1"].ToString());
                bookViewModel.from2 = dr["F2"] == DBNull.Value ? (TimeSpan?)null : TimeSpan.Parse(dr["F2"].ToString());
                bookViewModel.to2   = dr["T2"] == DBNull.Value ? (TimeSpan?)null : TimeSpan.Parse(dr["T2"].ToString());
                bookViewModel.from3 = dr["F3"] == DBNull.Value ? (TimeSpan?)null : TimeSpan.Parse(dr["F3"].ToString());
                bookViewModel.to3   = dr["T3"] == DBNull.Value ? (TimeSpan?)null : TimeSpan.Parse(dr["T3"].ToString());

                bookViewModel.allowedDays = commonBusiness.AssignValidTimeslot(bookViewModel.from1, bookViewModel.to1, bookViewModel.from2, bookViewModel.to2, bookViewModel.from3, bookViewModel.to3);

                ModelState.Clear();
            }
            else
            {
                ViewBag.ErrorRegister = "No data found for Doctor's profile!";
            }
            return(View("Book", bookViewModel));
        }