public ServiceResponse <bool> UpdateCv(CvDTO cvRequest, int userId) { var serviceResponse = new ServiceResponse <bool>(); try { if (IsUsedCvUrl(cvRequest.CvUrl, userId)) { return(serviceResponse.Error("Bu Url Adresi kullanılıyor")); } var cv = _cvRepository.Get(x => x.UserId == userId); cv.PhoneNumber = cvRequest.PhoneNumber; cv.AboutDescription = cvRequest.AboutDescription; cv.BirthDay = cvRequest.BirthDay; cv.CvUrl = cvRequest.CvUrl; cv.Email = cvRequest.Email; cv.Location = cvRequest.Location; cv.Name = cvRequest.Name; cv.SurName = cvRequest.SurName; cv.Website = cvRequest.Website; cv.City = cvRequest.City; _cvRepository.Update(cv); serviceResponse.Data = true; return(serviceResponse.Success()); } catch (Exception ex) { return(serviceResponse.Error("Cv Bilgileri Güncellenemedi")); } }
public ServiceResponse <int> CreateCv([FromBody] CvDTO cvCreateDTO) { var claims = GetUserClaims(); cvCreateDTO.UserId = claims.UserId; return(_userService.CreateCv(cvCreateDTO, claims.UserId)); }
public ServiceResponse <int> CreateCv(CvDTO cvRequest, int userId) { var serviceResponse = new ServiceResponse <int>(); try { var cv = _mapper.Map <Cv>(cvRequest); if (cvRequest.Socials != null) { cv.Facebook = cvRequest.Socials.Facebook; cv.Instagram = cvRequest.Socials.Instagram; cv.Twitter = cvRequest.Socials.Twitter; cv.Linkedin = cvRequest.Socials.Linkedin; cv.Medium = cvRequest.Socials.Medium; cv.Youtube = cvRequest.Socials.Youtube; } if (IsUsedCvUrl(cvRequest.CvUrl, userId)) { return(serviceResponse.Error("Bu Url Adresi kullanılıyor")); } _cvRepository.Create(cv); if (cv.CvId < 1) { return(serviceResponse.Error("Cv Oluşturulamadı")); } var isAddSchools = _schoolService.AddUserSchoolList(cvRequest.UserSchools, userId); var isAddCompanies = _companyService.AddUserCompanyList(cvRequest.UserCompanies, userId); return(serviceResponse.Success()); } catch (Exception ex) { return(serviceResponse.Error("Cv oluşturulamadı")); } }
public ServiceResponse <bool> UpdateCv([FromBody] CvDTO cvUpdateDTO) { var claims = GetUserClaims(); var response = new ServiceResponse <bool>(); var usedCvResponse = _userService.CheckCvUrl(cvUpdateDTO.CvUrl, claims.UserId); if (!usedCvResponse.Data) { response = _userService.UpdateCv(cvUpdateDTO, claims.UserId); } else { response.IsSuccess = false; response.Message = usedCvResponse.Message; } return(response); }