public async Task SaveAsync(List <S> people) { List <T> dtos = new List <T>(); List <U> identities = new List <U>(); people.ForEach(person => { dtos.Add(mapper.Map <T, S>(person)); identities.Add(mapper.Map <U, S>(person)); }); await repository.SaveFacultyAsync(dtos); await identityRepository.SaveAsync(identities); }
public void Add(OrderModel order) { Guard.WhenArgument(order, "order").IsNull().Throw(); var mapped = mapper.Map <OrderModel, Order>(order); this.orders.Add(mapped); unitOfWork.SaveChanges(); }
public ListQueryResult<Core.Domian.Settings.IssueManagementCommentLog> GetByQuery(ListQuery<Core.Domian.Settings.IssueManagementCommentLog> query) { var result = new ListQueryResult<Teckraft.Core.Domian.Settings.IssueManagementCommentLog>(); var list = new List<Teckraft.Core.Domian.Settings.IssueManagementCommentLog>(); using (Teckraft.Data.Sql.InitiativeHubFinalEntities dbcontext = new Teckraft.Data.Sql.InitiativeHubFinalEntities()) { var linqquery = dbcontext.IssueManagementCommentLogs.Where(it => it.Id > 0); if (query.Parameters.Count > 0) { foreach (var item in query.Parameters) { if (item.Name == "RequestNo") { var val = item.Value; linqquery = linqquery.Where(k => k.ID_Request == val); } else if (item.Name == "ChapterName") { var val = item.Value; linqquery = linqquery.Where(j => j.id_System_Name == val); } else if (item.Name == "PendingWithEmail") { var val = (item.Value); linqquery = linqquery.Where(it => (it.ID_Pending_With_Email == val)); } } linqquery = linqquery.OrderByDescending(it => it.RCT); foreach (var dbitem in linqquery) { list.Add(mappingProvider.Map(dbitem)); } } } result.Items = list; return result; }
public User Map(Sql.UserDetail item) { if (item == null) { return(null); } return(new User() { Id = item.UserId, UserName = item.UserName, Email = item.Email, Title = item.Title, Division = divisionMapper.Map(item.Division), MobileNo = item.MobileNo }); }
public dynamic CreateConcreteObject(object obj) { var type = obj.GetType(); return(_mappingProvider.Map(obj, type, type)); }