Exemple #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);
            }
        }
Exemple #2
0
        public bool Update()
        {
            try
            {
                this.DoctorChamberRelations   = this.ChamberSelectedIdsToDoctorChamberRelations().ToList();
                this.DoctorSpecialtyRelations = this.SpecialtySelectedIdsToDoctorSpecialtyRelations().ToList();
                this.DoctorDegreeRelations    = this.DegreeSelectedIdsToDoctorDegreeRelations().ToList();
                this.ImageUrl = CustomFile.SaveImageFile(this.ImageFileBase,
                                                         AuthenticatedDoctorUserModel.GetUserFromIdentity().Name,
                                                         AuthenticatedDoctorUserModel.GetUserFromIdentity().Id, "Doctor");
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
                return(false);
            }

            return(_doctorService.Update(this));
        }