private static WorkExperience ToDomain(WorkExperienceEntity entity) { return(new WorkExperience( entity.Id.ToString(), entity.ProfileId.ToString(), entity.StartWork, entity.FinishWork, entity.CompanyName)); }
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()); }