예제 #1
0
 private static WorkExperience ToDomain(WorkExperienceEntity entity)
 {
     return(new WorkExperience(
                entity.Id.ToString(),
                entity.ProfileId.ToString(),
                entity.StartWork,
                entity.FinishWork,
                entity.CompanyName));
 }
예제 #2
0
        public async Task <string> InsertAsync(WorkExperience workExperience)
        {
            if (!long.TryParse(workExperience.ProfileId, out var lProfileId))
            {
                throw new AggregateException(nameof(workExperience.ProfileId));
            }

            var newWorkExperience = new WorkExperienceEntity
            {
                ProfileId   = lProfileId,
                FinishWork  = workExperience.FinishWork,
                StartWork   = workExperience.StartWork,
                CompanyName = workExperience.CompanyName
            };

            await context.WorkExperience.AddAsync(newWorkExperience);

            await context.SaveChangesAsync();

            return(newWorkExperience.Id.ToString());
        }