Ejemplo n.º 1
0
 public async Task<ApiJsonResult> UpdateJobSeekerProfile(JobSeekerProfileUpdatedPersonalInfoParams param)
 {
     try {
         Guid userId = GetCurrentUserId();
         await new AccountManager(userId).UpdateJobSeekerProfile(param);
         return new ApiJsonResult { Success = true, Data = null };
     }
     catch (Exception ex) {
         return ProcessException(ex);
     }
 }
Ejemplo n.º 2
0
        //job seeker profile
        public async Task UpdateJobSeekerProfile(JobSeekerProfileUpdatedPersonalInfoParams param)
        {
            Utils.CheckNullOrEmpty(new List<string> { "DateOfBirth", "Email", "FullName", "Gender", "NRICNumber", "NRICType", "NationalServiceStatus", "UserId", "PostalCode", "PhoneNumber" }, param.DateOfBirth, param.Email, param.FullName, param.Gender, param.NRICNumber, param.NRICType, param.NationalServiceStatus, param.UserId, param.PostalCode, param.PhoneNumber);

            using (AppDbContext context = new AppDbContext())
            {
                User user = await context.Users.FirstOrDefaultAsync(p => p.Id == param.UserId);
                JobSeeker jobSeeker = await context.JobSeekers.FirstOrDefaultAsync(p => p.UserId == param.UserId);

                if (jobSeeker == null || user == null)
                {
                    throw new UserException(ErrorCode.INVALID_SESSION.ToString());
                }

                user.Email = param.Email;
                jobSeeker.FullName = param.FullName;
                jobSeeker.Gender = param.Gender;
                jobSeeker.NationalServiceStatus = param.NationalServiceStatus;
                jobSeeker.DateOfBirth = param.DateOfBirth;
                jobSeeker.NRICNumber = param.NRICNumber;
                jobSeeker.NRICType = param.NRICType;
                jobSeeker.Race = param.Race;
                jobSeeker.Religions = param.Religions;
                jobSeeker.PhoneNumber = param.PhoneNumber;
                jobSeeker.MobileNumber = param.MobileNumber;
                jobSeeker.PostalCode = param.PostalCode;
                jobSeeker.Address = param.Address;
                jobSeeker.UpdatedDateUtc = DateTime.UtcNow;

                await context.SaveChangesAsync();
            }
        }