Example #1
0
        public DoctorModel(int id) : this()
        {
            var existingDoctor = _doctorService.GetByUserId(AuthenticatedDoctorUserModel.GetUserFromIdentity().Id);

            if (existingDoctor != null)
            {
                this.Id                       = existingDoctor.Id;
                this.User                     = existingDoctor.User;
                this.UserId                   = existingDoctor.UserId;
                this.FathersName              = existingDoctor.FathersName;
                this.MothersName              = existingDoctor.MothersName;
                this.PresentAddress           = existingDoctor.PresentAddress;
                this.PermanentAddress         = existingDoctor.PermanentAddress;
                this.Awards                   = existingDoctor.Awards;
                this.BloodGroupId             = existingDoctor.BloodGroupId;
                this.BloodGroup               = existingDoctor.BloodGroup;
                this.DateOfBirth              = existingDoctor.DateOfBirth;
                this.Description              = existingDoctor.Description;
                this.Designation              = existingDoctor.Designation;
                this.Phone                    = existingDoctor.Phone;
                this.Status                   = existingDoctor.Status;
                this.UpdatedAt                = existingDoctor.UpdatedAt;
                this.Experience               = existingDoctor.Experience;
                this.GenderId                 = existingDoctor.GenderId;
                this.Gender                   = existingDoctor.Gender;
                this.ImageUrl                 = existingDoctor.ImageUrl;
                this.DoctorChamberRelations   = existingDoctor.DoctorChamberRelations;
                this.DoctorDegreeRelations    = existingDoctor.DoctorDegreeRelations;
                this.DoctorSpecialtyRelations = existingDoctor.DoctorSpecialtyRelations;

                this.ChamberSelectedIds   = existingDoctor.DoctorChamberRelations.Select(x => x.ChamberId);
                this.SpecialtySelectedIds = existingDoctor.DoctorSpecialtyRelations.Select(x => x.SpecialtyId);
                this.DegreeSelectedIds    = existingDoctor.DoctorDegreeRelations.Select(x => x.DegreeId);
            }
        }
        public static Entities.Doctor GetDoctorUserFromIdentity()
        {
            var authUser       = (HttpContext.Current.User as DRF.Authentication.CustomPrincipal).Identity as DRF.Authentication.CustomIdentity;
            var authDoctorUser = _doctorService.GetByUserId(authUser.User.Id);

            return(authDoctorUser);
        }