public async Task SaveAsync(FormOfEducation formOfEducation) { try { if (formOfEducation == null) { return; } using (var timeLineContext = _contextFactory.GetTimeLineContext()) { var entityFormOfEducation = await timeLineContext .FormsOfEducation .FirstOrDefaultAsync(item => item.Id.Equals(formOfEducation.Id)).ConfigureAwait(false); if (entityFormOfEducation == null) { entityFormOfEducation = new DA.FormOfEducation(); MapForUpdateFormOfEducation(formOfEducation, entityFormOfEducation); await timeLineContext.FormsOfEducation.AddAsync(entityFormOfEducation).ConfigureAwait(false); } else { MapForUpdateFormOfEducation(formOfEducation, entityFormOfEducation); } timeLineContext.SaveChanges(); } } catch (Exception ex) { throw ex; } }
private void MapForUpdateFormOfEducation(FormOfEducation trainer, DA.FormOfEducation entityTrainer) { entityTrainer.Description = trainer.Description; }