コード例 #1
0
        //
        public IActionResult AddEdit(string id)
        {
            PatientRxView lPatientRx = new PatientRxView();

            try
            {
                if (!string.IsNullOrEmpty(id))
                {
                    getDetails();
                    PatientRx patientRx = lIPatientRxRepository.getById(id);
                    if (patientRx != null)
                    {
                        lPatientRx = patientRx.PatientRxToPatientRxViewModel();
                    }
                }
                else
                {
                    if (!string.IsNullOrEmpty(HttpContext.Session.GetString("UserId")))
                    {
                        lPatientRx.ProviderId = HttpContext.Session.GetString("UserId");
                        lPatientRx.RxDays     = new List <checkboxModel>
                        {
                            new checkboxModel {
                                id = 1, name = "SUN", isCheck = false
                            },
                            new checkboxModel {
                                id = 2, name = "MON", isCheck = false
                            },
                            new checkboxModel {
                                id = 3, name = "TUE", isCheck = false
                            },
                            new checkboxModel {
                                id = 4, name = "WED", isCheck = false
                            },
                            new checkboxModel {
                                id = 5, name = "THR", isCheck = false
                            },
                            new checkboxModel {
                                id = 6, name = "FRI", isCheck = false
                            },
                            new checkboxModel {
                                id = 7, name = "SAT", isCheck = false
                            }
                        };
                        getDetails();
                    }
                    else
                    {
                        ViewBag.equipment = null;
                        ViewBag.Patients  = null;
                    }
                }
            }
            catch (Exception ex)
            {
                logger.LogDebug("Patent Rx Error: " + ex);
            }
            return(View(lPatientRx));
        }