public static OneononeModel ToModel(this OneononeEntity entity) { if (entity == null) { return(null); } var model = new OneononeModel { Id = entity.Id, LeaderId = entity.Leader.Id, LedId = entity.Led.Id, Frequency = (int)entity.Frequency, }; return(model); }
public static OneononeEntity ToEntity(this OneononeModel model) { if (model == null) { return(null); } var entity = new OneononeEntity { Id = model.Id, Leader = new EmployeeEntity { Id = model.LeaderId }, Led = new EmployeeEntity { Id = model.LedId }, Frequency = (FrequencyEnum)model.Frequency, }; return(entity); }