Пример #1
0
        /// <summary>
        /// 获取所有分页测试数据
        /// </summary>
        /// <returns></returns>
        public async Task <PagedResult <DemoOutput> > GetModels()
        {
            PagedResult <DemoOutput>    models       = new PagedResult <DemoOutput>();
            PagedResult <Domain.T_Demo> SourceModels = await iDemoRepository.GetModels();

            try
            {
                models.Data         = modelMapper.Map <List <DemoOutput> >(SourceModels.Data);
                models.PageIndex    = SourceModels.PageIndex;
                models.PageSize     = SourceModels.PageSize;
                models.TotalPages   = SourceModels.TotalPages;
                models.TotalRecords = SourceModels.TotalRecords;
                //models = modelMapper.Map<IEnumerable<Domain.Sys_UserInfo>, IEnumerable<UserInfoOutput>>(SourceModels);
            }
            catch (Exception ex)
            {
                throw ex;
            }

            return(models);
        }
        public async Task <List <Models.Buyer> > Get()
        {
            var buyers = await _queryBus.SendAsync <GetAllBuyers, IReadOnlyList <Buyer> >(new GetAllBuyers());

            var buyersList = new List <Models.Buyer>();

            foreach (var buyer in buyers)
            {
                buyersList.Add(_mapper.Map <Buyer, Models.Buyer>(buyer));
            }
            return(buyersList);
        }
        public async Task <IActionResult> Index()
        {
            var viewModel = new IndexViewModel()
            {
                LocalPath = LocalPath,
            };
            var contentPageModels = await jobCategoryPageContentService.GetAllAsync().ConfigureAwait(false);

            if (contentPageModels != null)
            {
                viewModel.Documents = (from a in contentPageModels.OrderBy(o => o.CanonicalName)
                                       select mapper.Map <IndexDocumentViewModel>(a)).ToList();
                logger.LogInformation($"{nameof(Index)} has succeeded");
            }
            else
            {
                logger.LogWarning($"{nameof(Index)} has returned with no results");
            }

            return(this.NegotiateContentResult(viewModel));
        }
Пример #4
0
        /// <summary>
        /// 添加数据的方法
        /// </summary>
        /// <param name="reg">数据</param>
        /// <returns></returns>
        public async Task <ResultDTO> AddData(ContactsDTO reg)
        {
            var soucreContacts = _mapper.Map <Contacts>(reg);

            soucreContacts.Id = System.Guid.NewGuid();
            var selectData = await Db.SingleOrDefaultAsync <Contacts>("where phone = @0", soucreContacts.Phone);

            if (selectData != null)
            {
                return(new ResultDTO(200, "该号码已存在", selectData, ResultStatus.Error));
            }
            if (await Db.InsertAsync(soucreContacts) != null)
            {
                var result = _mapper.Map <ContactsDTO>(soucreContacts);
                return(new ResultDTO(200, "添加成功", soucreContacts, ResultStatus.Suceess));
            }
            else
            {
                return(new ResultDTO(200, "添加失败", reg, ResultStatus.Fail));
            }
        }
        public async Task <IActionResult> Index()
        {
            logService.LogInformation($"{nameof(Index)} has been called");

            var viewModel = new IndexViewModel();
            var currentOpportunitiesSegmentModels = await currentOpportunitiesSegmentService.GetAllAsync().ConfigureAwait(false);

            if (currentOpportunitiesSegmentModels != null)
            {
                viewModel.Documents = (from a in currentOpportunitiesSegmentModels.OrderBy(o => o.CanonicalName)
                                       select mapper.Map <IndexDocumentViewModel>(a)).ToList();

                logService.LogInformation($"{nameof(Index)} has succeeded");
            }
            else
            {
                logService.LogWarning($"{nameof(Index)} has returned with no results");
            }

            return(this.NegotiateContentResult(viewModel, viewModel.Documents));
        }
        public async Task <IActionResult> Index()
        {
            logService.LogInformation($"{IndexActionName} has been called");

            var viewModel = new IndexViewModel();
            var relatedCareersSegmentModels = await relatedCareersSegmentService.GetAllAsync().ConfigureAwait(false);

            if (relatedCareersSegmentModels != null)
            {
                viewModel.Documents = (from a in relatedCareersSegmentModels.OrderBy(o => o.CanonicalName)
                                       select mapper.Map <IndexDocumentViewModel>(a)).ToList();

                logService.LogInformation($"{IndexActionName} has succeeded");
            }
            else
            {
                logService.LogWarning($"{IndexActionName} has returned with no results");
            }

            return(View(viewModel));
        }
Пример #7
0
        public static T Map <S, T>(object source)
        {
            var config = new AutoMapper.MapperConfiguration(cfg =>
            {
                cfg.CreateMap <S, T>();
            });

            AutoMapper.IMapper mapper = config.CreateMapper();
            var result = mapper.Map <S, T>((S)source);

            return(result);
        }
Пример #8
0
        public async Task <ActionResult <IEnumerable <PostModel> > > GetAllPosts()
        {
            var posts = await _postService.GetAllPosts();

            var postsModel = _mapper.Map <IEnumerable <Post>, IEnumerable <PostModel> >(posts);

            foreach (PostModel post in postsModel)
            {
                var profile = await _profileService.GetProfileById(post.UserId);

                post.Username = profile.Username;
            }
            return(Ok(postsModel));
        }
Пример #9
0
        public void Compra(string sucursal, string folio)
        {
            var venta = _proxy.GetReciboCompra(sucursal, folio);

            var item      = _mapper.Map <SirCoPOS.Reports.Entities.ReciboCompra>(venta.Recibo);
            var productos = _mapper.Map <IEnumerable <SirCoPOS.Reports.Entities.Producto> >(venta.Productos);
            var pagos     = _mapper.Map <IEnumerable <SirCoPOS.Reports.Entities.Pago> >(venta.Pagos);
            var planPagos = _mapper.Map <IEnumerable <SirCoPOS.Reports.Entities.PlanPago> >(venta.PlanPagos);

            //item.CantidadLetra = item.Cantidad.ToLetras();
            var list = new List <SirCoPOS.Reports.Entities.ReciboCompra>()
            {
                item
            };
            var dic = new Dictionary <string, IEnumerable <object> >()
            {
                { "reciboDataSet", list },
                { "productosDataSet", productos },
                { "pagosDataSet", pagos },
                { "planPagosDataSet", planPagos }
            };

            _viewer.OpenViewer(
                fullname: "SirCoPOS.Reports.ReciboVenta.rdlc",
                library: "SirCoPOS.Reports",
                datasources: dic);
        }
Пример #10
0
 public RR.AgencyDomesticPolicyResponse GetDomesticAgencyPolicy(RR.AgencyDomesticRequest request)
 {
     try
     {
         if (ModelState.IsValid)
         {
             BLO.AgencyDomesticRequest        domestic = _mapper.Map <RR.AgencyDomesticRequest, BLO.AgencyDomesticRequest>(request);
             BLO.AgencyDomesticPolicyResponse result   = _domesticHelpRepo.GetDomesticAgencyPolicy(domestic);
             return(_mapper.Map <BLO.AgencyDomesticPolicyResponse, RR.AgencyDomesticPolicyResponse>(result));
         }
         else
         {
             var message = string.Join(" | ", ModelState.Values.SelectMany(v => v.Errors).Select(e => e.ErrorMessage));
             return(new RR.AgencyDomesticPolicyResponse()
             {
                 IsTransactionDone = false,
                 TransactionErrorMessage = message
             });
         }
     }
     catch (Exception ex)
     {
         return(new RR.AgencyDomesticPolicyResponse()
         {
             IsTransactionDone = false,
             TransactionErrorMessage = ex.Message
         });
     }
 }
Пример #11
0
        public async Task <IActionResult> GetUsers([FromQuery] UserParams userParams)
        {
            var currentUserId = int.Parse(User.FindFirst(ClaimTypes.NameIdentifier).Value);

            var userFromRepo = await _repo.GetUser(currentUserId);

            userParams.UserId = currentUserId;

            if (string.IsNullOrEmpty(userParams.Gender))
            {
                userParams.Gender = userFromRepo.Gender == "male" ? "female" : "male";
            }

            var users = await _repo.GetUsers(userParams);

            var usersToReturn = _mapper.Map <IEnumerable <UserForListDto> >(users);

            Response.AddPagination(users.CurrentPage, users.PageSize,
                                   users.TotalCount, users.TotalPages);

            return(Ok(usersToReturn));
        }
Пример #12
0
        public async Task <ResponsesDto <SeasonResponseDto> > GetAllSeasons(int tvSeriesId)
        {
            var response       = new ResponsesDto <SeasonResponseDto>();
            var tvSeriesExists = await _tvShowRepository.ExistAsync(x => x.Id == tvSeriesId);

            if (!tvSeriesExists)
            {
                response.AddError(Model.TvShow, Error.tvShow_NotFound);
            }

            var seasons       = _seasonRepository.GetAllBy(x => x.TvShowId == tvSeriesId, x => x.Episodes);
            var mappedSeasons = new List <SeasonResponseDto>();

            foreach (var season in seasons)
            {
                mappedSeasons.Add(_mapper.Map <SeasonResponseDto>(season));
            }

            response.DtoObject = mappedSeasons;

            return(response);
        }
Пример #13
0
        public async Task <ActionResult> Create(CreateRoleModel model)
        {
            if (ModelState.IsValid)
            {
                if (_roleInfoService.GetSingle(s => s.Name.ToLower() == model?.Name?.ToLower()) == null)
                {
                    var role   = Mapper.Map <CreateRoleModel, RoleInfo>(model);
                    var result = await RoleManager.CreateAsync(role);

                    if (result.Succeeded)
                    {
                        return(RedirectToAction("Index"));
                    }
                    else
                    {
                        ModelState.AddModelError(string.Empty, "Произошла ошибка");
                    }
                }
                ModelState.AddModelError("Name", "Такая роль пользователя уже существует в системе. Пожалуйста, введите другое наименование роли");
            }
            return(View(model));
        }
Пример #14
0
        public async Task <PagedResult <ProfileListItemModel> > GetProfiles(ProfileListFilterModel filter, int page, int size)
        {
            PagedResult <ProfileListItemModel> result = null;


            var filterDefinition = CreateFilterDefinition(filter);

            var cnt = await _context.Profiles.CountAsync(filterDefinition);

            var profiles = _context.Profiles.Find(
                filterDefinition: filterDefinition,
                pageIndex: page,
                size: size,
                isDescending: false,
                order: p => p.LastName);

            var items = _mapper.Map <IEnumerable <ProfileListItemModel> >(profiles);

            result = new PagedResult <ProfileListItemModel>(items, cnt);

            return(result);
        }
Пример #15
0
        public async Task <PagedResult <LogModel> > GetLogs(int page, int size)
        {
            PagedResult <LogModel> result = null;

            var fd = _context.Logs.Filter.Eq(p => p.EventType, "ProfileSearch");
            //fd = fd | _context.Logs.Filter.Eq(p=>p.EventType, "AccountDeactivated");

            var cnt = await _context.Logs.CountAsync(fd);

            //var cnt = await _context.Logs.CountAsync();

            var logs = _context.Logs.Find(
                filterDefinition: fd,
                pageIndex: page,
                size: size,
                isDescending: true,
                order: l => l.TimeTriggered);
            var items = _mapper.Map <IEnumerable <LogModel> >(logs);

            result = new PagedResult <LogModel>(items, cnt);
            return(result);
        }
        public async Task <IEnumerable <UserProfileResource> > GetAllAsync()
        {
            var profiles = await _profileService.ListAsync();

            var resource = _mapper.Map <IEnumerable <GoingTo_API.Domain.Models.Accounts.UserProfile>, IEnumerable <UserProfileResource> >(profiles);

            return(resource);
        }
        public async Task <IEnumerable <UserProfileResource> > GetAllAsync()
        {
            var profiles = await _profileService.ListAsync();

            var resource = _mapper.Map <IEnumerable <UserProfile>, IEnumerable <UserProfileResource> >(profiles);

            return(resource);
        }
Пример #18
0
        public IO.Swagger.Models.TrackingInformation TrackParcel(string trackingNumber)
        {
            try
            {
                var dalParcel = _parcelRepo.GetByTrackingNumber(trackingNumber);
                if (dalParcel == null)
                {
                    throw new BlException("Parcel not found in Database");
                }

                var hopArr = _hopRepo.GetByTrackingInformationId(dalParcel.TrackingInformationId);

                foreach (var h in hopArr)
                {
                    if (h.Status == "visited")
                    {
                        dalParcel.TrackingInformation.VisitedHops.Add(h);
                    }
                    else if (h.Status == "future")
                    {
                        dalParcel.TrackingInformation.FutureHops.Add(h);
                    }
                }

                var blParcel = _mapper.Map <Parcel>(dalParcel);
                if (blParcel != null)
                {
                    _logger.LogError(ValidateParcel(blParcel));
                }
                var info = _mapper.Map <IO.Swagger.Models.TrackingInformation>(blParcel.TrackingInformation);
                return(info);
            }
            catch (Exception ex)
            {
                _logger.LogError("Could not find parcel", ex);
                throw new BlException("Could not find parcel", ex);
            }
        }
Пример #19
0
        public async Task <IActionResult> Index()
        {
            logService.LogInformation($"{IndexActionName} has been called");

            var viewModel     = new IndexViewModel();
            var segmentModels = await jobProfileTasksSegmentService.GetAllAsync().ConfigureAwait(false);

            if (segmentModels != null)
            {
                viewModel.Documents = segmentModels
                                      .OrderBy(x => x.CanonicalName)
                                      .Select(x => mapper.Map <IndexDocumentViewModel>(x))
                                      .ToList();

                logService.LogInformation($"{IndexActionName} has succeeded");
            }
            else
            {
                logService.LogWarning($"{IndexActionName} has returned with no results");
            }

            return(View(viewModel));
        }
Пример #20
0
        public async Task <ResponsesDto <ReturnEpisodeDto> > GetMonthEpisodes(int monthNumber)
        {
            var response = new ResponsesDto <ReturnEpisodeDto>();

            if (monthNumber > 12 || monthNumber < 1)
            {
                response.AddError(Model.Calendar, Error.calendar_Wrong_Month);
                return(response);
            }

            var episodes = _episodeRepository.GetAllBy(x => x.AiringDate.Month == monthNumber, x => x.Season, x => x.Season.TvShow, x => x.Season.TvShow.TvSeriesRatings);

            var mappedEpisodes = new List <ReturnEpisodeDto>();

            foreach (var episode in episodes)
            {
                mappedEpisodes.Add(_mapper.Map <ReturnEpisodeDto>(episode));
            }

            response.DtoObject = mappedEpisodes;

            return(response);
        }
Пример #21
0
        public async Task <IActionResult> Configuration(int id)
        {
            var site = await _siteLookupService.GetByIdAsync(id);

            var viewModel = _mapper.Map <Site, SiteConfigurationViewModel>(site);

            var user = await _userService.GetDetails(GetActiveUserId());

            if (user != null && !string.IsNullOrEmpty(user.Email))
            {
                viewModel.CurrentUserMail = user.Email;
            }

            PageTitle = $"Site management - {site.Name}";
            return(View(viewModel));
        }
Пример #22
0
        /// <summary>
        /// Get the active Loan from an user
        /// </summary>
        /// <param name="personaId">Customer that has the active loan</param>
        /// <returns></returns>
        PrestamoDTO IPrestamoRepository.GetPrestamoActivoPersona(int personaId)
        {
            PrestamoDTO prestamo = null;

            using (var _dbContext = new FondoContext(_contextOptions))
            {
                var prestamoActivo = _dbContext.Prestamo.AsNoTracking().Where(x => !x.Finalizado && x.PersonaId == personaId).Include(x => x.Consignaciones).FirstOrDefault();
                if (null != prestamoActivo)
                {
                    prestamo = _mapper.Map <Prestamo, PrestamoDTO>(prestamoActivo);
                }
            }
            return(prestamo);
        }
Пример #23
0
        public async Task CacheReloadServiceReloadIsSuccessfulForCreate()
        {
            // arrange
            const int NumerOfSummaryItems           = 2;
            const int NumberOfDeletions             = 3;
            var       cancellationToken             = new CancellationToken(false);
            var       expectedValidContentPageModel = BuildValidContentPageModel();
            var       fakePagesSummaryItemModels    = BuldFakePagesSummaryItemModel(NumerOfSummaryItems);
            var       fakeCachedContentPageModels   = BuldFakeContentPageModels(NumberOfDeletions);

            A.CallTo(() => fakeCmsApiService.GetSummaryAsync <CmsApiSummaryItemModel>()).Returns(fakePagesSummaryItemModels);
            A.CallTo(() => fakeCmsApiService.GetItemAsync <CmsApiDataModel>(A <Uri> .Ignored)).Returns(A.Fake <CmsApiDataModel>());
            A.CallTo(() => fakeMapper.Map <ContentPageModel>(A <CmsApiDataModel> .Ignored)).Returns(expectedValidContentPageModel);
            A.CallTo(() => fakeEventMessageService.UpdateAsync(A <ContentPageModel> .Ignored)).Returns(HttpStatusCode.NotFound);
            A.CallTo(() => fakeEventMessageService.CreateAsync(A <ContentPageModel> .Ignored)).Returns(HttpStatusCode.Created);
            A.CallTo(() => fakeEventMessageService.GetAllCachedItemsAsync()).Returns(fakeCachedContentPageModels);
            A.CallTo(() => fakeEventMessageService.DeleteAsync(A <Guid> .Ignored)).Returns(HttpStatusCode.OK);
            A.CallTo(() => fakeContentCacheService.AddOrReplace(A <Guid> .Ignored, A <List <Guid> > .Ignored, A <string> .Ignored));

            var cacheReloadService = new CacheReloadService(fakeLogger, fakeMapper, fakeEventMessageService, fakeCmsApiService, fakeContentCacheService, fakeAppRegistryService, fakeContentTypeMappingService, fakeApiCacheService);

            // act
            await cacheReloadService.Reload(cancellationToken).ConfigureAwait(false);

            // assert
            A.CallTo(() => fakeContentTypeMappingService.AddMapping(A <string> .Ignored, A <Type> .Ignored)).MustHaveHappenedOnceOrMore();
            A.CallTo(() => fakeCmsApiService.GetSummaryAsync <CmsApiSummaryItemModel>()).MustHaveHappenedOnceExactly();
            A.CallTo(() => fakeContentCacheService.Clear()).MustHaveHappenedOnceExactly();
            A.CallTo(() => fakeCmsApiService.GetItemAsync <CmsApiDataModel>(A <Uri> .Ignored)).MustHaveHappened(NumerOfSummaryItems, Times.Exactly);
            A.CallTo(() => fakeMapper.Map <ContentPageModel>(A <CmsApiDataModel> .Ignored)).MustHaveHappened(NumerOfSummaryItems, Times.Exactly);
            A.CallTo(() => fakeEventMessageService.UpdateAsync(A <ContentPageModel> .Ignored)).MustHaveHappened(NumerOfSummaryItems, Times.Exactly);
            A.CallTo(() => fakeEventMessageService.CreateAsync(A <ContentPageModel> .Ignored)).MustHaveHappened(NumerOfSummaryItems, Times.Exactly);
            A.CallTo(() => fakeEventMessageService.GetAllCachedItemsAsync()).MustHaveHappenedTwiceExactly();
            A.CallTo(() => fakeEventMessageService.DeleteAsync(A <Guid> .Ignored)).MustHaveHappened(NumberOfDeletions, Times.Exactly);
            A.CallTo(() => fakeContentCacheService.AddOrReplace(A <Guid> .Ignored, A <List <Guid> > .Ignored, A <string> .Ignored)).MustHaveHappened(NumerOfSummaryItems, Times.Exactly);
            A.CallTo(() => fakeAppRegistryService.PagesDataLoadAsync()).MustHaveHappenedOnceExactly();
        }
Пример #24
0
        public async virtual Task <DomainEntity> GetByIdAsync(int id)
        {
            var entity = await DbSet
                         .AsNoTracking()
                         .Where(_ => _.Id == id)
                         .SingleOrDefaultAsync();

            if (entity == null)
            {
                throw new Exception($"{nameof(DomainEntity)} id {id} could not be found.");
            }
            return(_mapper.Map <DbEntity, DomainEntity>(entity));
        }
 public RR.MotorReportResponse GetMotorReport(RR.AdminFetchReportRequest reportRequest)
 {
     try
     {
         BLO.AdminFetchReportRequest request = _mapper.Map <RR.AdminFetchReportRequest, BLO.AdminFetchReportRequest>(reportRequest);
         BLO.MotorReportResponse     result  = _ReportRepo.GetMotorReport(request);
         return(_mapper.Map <BLO.MotorReportResponse, RR.MotorReportResponse>(result));
     }
     catch (Exception ex)
     {
         return(new RR.MotorReportResponse
         {
             IsTransactionDone = false,
             TransactionErrorMessage = ex.Message
         });
     }
 }
Пример #26
0
        public virtual ActionResult <IEnumerable <CollectedDataDto> > GetDataForBuilder()
        {
            var data     = new List <CollectedDataDto>(20);
            var dateTime = DateTime.UtcNow;

            for (var i = 0; i < 20; i++)
            {
                var entity = CollectedDataService.GetFakeData(Guid.Empty, dateTime.AddSeconds(10 * i));
                entity.Id = Guid.NewGuid();
                var dto = _mapper.Map <CollectedData, CollectedDataDto>(entity);
                data.Add(dto);
            }

            return(Ok(data));
        }
Пример #27
0
        public async Task <IActionResult> Index()
        {
            var viewModel = new IndexViewModel()
            {
                Path      = LocalPath,
                Documents = new List <IndexDocumentViewModel>()
                {
                    new IndexDocumentViewModel {
                        Title = HealthController.HealthViewCanonicalName
                    },
                    new IndexDocumentViewModel {
                        Title = SitemapController.SitemapViewCanonicalName
                    },
                    new IndexDocumentViewModel {
                        Title = RobotController.RobotsViewCanonicalName
                    },
                },
            };
            var jobGroupModels = await jobGroupDocumentService.GetAllAsync().ConfigureAwait(false);

            if (jobGroupModels != null)
            {
                var documents = from a in jobGroupModels.OrderBy(o => o.Soc)
                                select mapper.Map <IndexDocumentViewModel>(a);

                viewModel.Documents.AddRange(documents);

                logger.LogInformation($"{nameof(Index)} has succeeded");
            }
            else
            {
                logger.LogWarning($"{nameof(Index)} has returned with no results");
            }

            return(this.NegotiateContentResult(viewModel));
        }
Пример #28
0
        public async Task <IActionResult> Register(RegistrationRequest request)
        {
            try
            {
                var profile = _mapper.Map <DomainModels.Profile>(request);

                var profileId = await _profileService.Create(profile);

                return(Ok(profileId));
            }
            catch (Exception ex)
            {
                return(Problem(ex.ToString()));
            }
        }
Пример #29
0
        public ActionResult Index(string tag = "")
        {
            //TODO: Implement the corresponding call to get all items or filtered by tag.
            //Return an instance of ListingViewModel.
            var results = string.IsNullOrEmpty(tag)
                ? KnowledgeQuery.GetAll()
                : KnowledgeQuery.GetByFilter(x => x.Tags.Contains(tag));

            ListingViewModel model = new ListingViewModel()
            {
                Questions = mapper.Map <List <QuestionAndAnswerItemModel> >(results),
                Tag       = tag
            };

            return(View("Index", model));
        }
        //public tbl_userPersonalDetail GetPersonalDetailByUserId(int id)
        //{
        //    return db.tbl_userPersonalDetail.FirstOrDefault(x => x.userId == id);
        //}

        //public Models.userPersonalDetailsModel GetPersonalDetailByUserId(int id)
        //{
        //    var userPersonalDetailsFromDb = db.tbl_userPersonalDetail.Where(x => x.userId == id).FirstOrDefault();
        //    //Creating AutoMapper Map for tbl_userDetails as source and userDetailsModel as destination
        //    var config = new AutoMapper.MapperConfiguration(cfg =>
        //    {
        //        cfg.CreateMap<DataAccessLayer.tbl_userPersonalDetail, Models.userPersonalDetailsModel>();
        //    });

        //    //Initiliazing or create an instance of mapper
        //    AutoMapper.IMapper mapper = config.CreateMapper();

        //    //Automapping userDetailsFromDb to userDetailsModel
        //    var userDetailsModel = mapper.Map<tbl_userPersonalDetail, userDetailsModel>(userPersonalDetailsFromDb);
        //    return userDetailsModel;
        //}

        public Models.userProfileImageModel GetProfileImageByUserId(int?id)
        {
            //Models.userProfileImageModel userProfileImage = new Models.userProfileImageModel();
            var userProfileImageFromDb = db.tbl_userProfileImages.FirstOrDefault(x => x.UserId == id);
            var config = new AutoMapper.MapperConfiguration(cfg =>
            {
                cfg.CreateMap <DataAccessLayer.tbl_userProfileImages, Models.userProfileImageModel>();
            });

            //Initiliazing or create an instance of mapper
            AutoMapper.IMapper mapper = config.CreateMapper();

            //Automapping userDetailsFromDb to userDetailsModel
            var userProfileImage = mapper.Map <Models.userProfileImageModel>(userProfileImageFromDb);

            return(userProfileImage);
        }