Automapper Example with Lists


            //List<spW3_SELECT_RLookup_Result> reps = db.spW3_SELECT_RLookup(1, myUserName).ToList();
            //Mapper.CreateMap<spW3_SELECT_RepLookup_Result, RLookupResults>();
            //TVM tVM = new TVM();
            //tVM.RepLookup_results = Mapper.Map<List<spW3_SELECT_RLookup_Result>, List<RLookupResults>>(reps);
            //tVM.sReps = new SelectedRs();



without Auto mapper




            //way to do this without automapper
            //var q = reps.Select(item => new RLookupResults()
            //    {
            //        rID = item.rID,
            //        RNumberID = item.RNumberID,
            //        rNumber = item.rNumber,
            //        rName = item.rName,
            //        Status = item.Status,
            //        defSelect = item.defSelect
            //    }).ToList();

Comments

Popular posts from this blog

Asp.net Publishing Broke Site - "App_WebReferences is not allowed because the application is precompiled"

Telerik - Custom Group Footers In RadGrid