public IHttpActionResult GetDoctor(RequestCarrier requestCarrier) { ResponseCarrier response; if (requestCarrier != null && requestCarrier.TanentId != 0 && requestCarrier.From != string.Empty && requestCarrier.UserId.HasValue) { if (requestCarrier.PayLoad != null) { var doctorViewModel = WebCommon.Instance.GetObject <DoctorViewModel>(requestCarrier.PayLoad); if (doctorViewModel != null && doctorViewModel.Id > 0) { var doctorModel = this._dataServices.DoctorService.GetDoctor(doctorViewModel.Id, requestCarrier.TanentId); _staticDataServices.Start(); doctorViewModel = this._doctorMapper.Map(doctorModel); response = new ResponseCarrier() { Status = true, PayLoad = doctorViewModel, ErrorMessage = string.Empty }; } else { doctorViewModel = _viewModelFactory.CreateDoctorViewModel(); response = new ResponseCarrier() { Status = true, PayLoad = doctorViewModel, ErrorMessage = string.Empty }; } } else { response = new ResponseCarrier() { Status = false, PayLoad = null, ErrorMessage = "Invalid Request. Doctor Id not provided.", TanentId = requestCarrier.TanentId }; } } else { response = new ResponseCarrier() { Status = false, PayLoad = null, ErrorMessage = "TanentId or RequestFrom or UserId(doctorId) not provided.", TanentId = requestCarrier.TanentId }; } return(Json(response)); }
public DoctorViewModel Map(DoctorModel doctorModel) { //var vm = am.Mapper.Map<DoctorViewModel>(doctorModel); //return vm; DoctorViewModel doctorViewModel = _viewModelFactory.CreateDoctorViewModel(); doctorViewModel.Id = doctorModel.Id; doctorViewModel.Password = doctorModel.Password; doctorViewModel.CityID = doctorModel.CityID; doctorViewModel.EmailAddress = doctorModel.EmailAddress; doctorViewModel.Address1 = doctorModel.Address1; doctorViewModel.CreatedBy = doctorModel.CreatedBy; doctorViewModel.CreatedByEntity = doctorModel.CreatedByEntity; doctorViewModel.CreatedOn = doctorModel.CreatedOn; doctorViewModel.FirstName = doctorModel.FirstName; doctorViewModel.LastName = doctorModel.LastName; doctorViewModel.OtherInformation = doctorModel.OtherInformation; doctorViewModel.ModifiedBy = doctorModel.ModifiedBy; doctorViewModel.ModifiedEntity = doctorModel.ModifiedByEntity; doctorViewModel.ModifiedOn = doctorModel.ModifiedOn; doctorViewModel.IsDeleted = doctorModel.IsDeleted; doctorViewModel.PhoneNumber = doctorModel.PhoneNumber; doctorViewModel.Pincode = doctorModel.Pincode; doctorViewModel.TanentId = doctorModel.TenantID; doctorViewModel.ProfilePhotoID = doctorModel.ProfilePhotoID <= 0 ? -1 : doctorModel.ProfilePhotoID; doctorViewModel.RegistrationNumber = doctorModel.RegistrationNumber; doctorViewModel.PersonalConsultationFee = doctorModel.PhoneConsultationFee; doctorViewModel.PhoneConsultationFee = doctorModel.PhoneConsultationFee; doctorViewModel.TextConsultationFee = doctorModel.TextConsultationFee; doctorViewModel.VideoConsultationFee = doctorModel.VideoConsultationFee; doctorViewModel.DoctorDescription = doctorModel.DoctorDescription; doctorViewModel.DoctorCode = doctorModel.DoctorCode; doctorViewModel.DoctorDegree = doctorModel.DoctorDegree != null?doctorModel.DoctorDegree.ToList() : new List <int>(); doctorViewModel.DoctorSpecialization = doctorModel.DoctorSpecialization != null?doctorModel.DoctorSpecialization.ToList() : new List <int>(); doctorViewModel.DoctorDesease = doctorModel.DoctorDesease != null?doctorModel.DoctorDesease.ToList() : new List <int>(); doctorViewModel.DoctorHospital = doctorModel.DoctorHospital != null?doctorModel.DoctorHospital.ToList() : new List <int>(); return(doctorViewModel); }