Пример #1
0
        protected Mapper CreateMapperProfile()
        {
            var myProfile     = new DtoProfile();
            var configuration = new MapperConfiguration(cfg => cfg.AddProfile(myProfile));

            return(new Mapper(configuration));
        }
Пример #2
0
        protected override void ConfigureMapper(IMapperConfigurationExpression cfg)
        {
            Profile profile = new DtoProfile();

            base.ConfigureMapper(cfg);
            profile.AddDataRecordMember();
            cfg.AddProfile(profile);
        }
Пример #3
0
        // This method gets called by the runtime. Use this method to add services to the container.
        public void ConfigureServices(IServiceCollection services)
        {
            services.AddMvc(o => o.EnableEndpointRouting = false).SetCompatibilityVersion(CompatibilityVersion.Version_2_2);
            services.AddSingleton(x => DtoProfile.CreateMapper());
            services.AddSingleton <IContextFactory, ContextFactory>();
            services.AddScoped <IProductsService, ProductsService>();

            services.AddSwaggerGen(c =>
            {
                c.SwaggerDoc("v1", new OpenApiInfo {
                    Title = "Product API", Version = "v1"
                });
            });
        }
Пример #4
0
        public void Upsert(DtoProfile profile)
        {
            var data = dc.Profile.FirstOrDefault();

            if (data == null)
            {
                data = new Profile();
                dc.Profile.Add(data);
            }

            data.Name        = profile.Name;
            data.Title       = profile.Title;
            data.Description = profile.Description;
            data.Email       = profile.Email;
            data.Facebook    = profile.Facebook;
            data.GitHub      = profile.Github;
            data.Instagram   = profile.Instagram;
            data.LinkEdin    = profile.Linkedin;
            data.Medium      = profile.Medium;

            dc.SaveChanges();
        }
Пример #5
0
        public DtoProfile GetById()
        {
            var data = dc.Profile.FirstOrDefault();

            DtoProfile profile = new DtoProfile();

            if (data != null)
            {
                profile.Id          = data.Id;
                profile.Name        = data.Name;
                profile.Title       = data.Title;
                profile.Description = data.Description;
                profile.Email       = data.Email;
                profile.Facebook    = data.Facebook;
                profile.Github      = data.GitHub;
                profile.Instagram   = data.Instagram;
                profile.Linkedin    = data.LinkEdin;
                profile.Medium      = data.Medium;
            }

            return(profile);
        }
Пример #6
0
 public object ProfileUpsert([FromBody] DtoProfile profile)
 {
     _Profile.Upsert(profile);
     return(profile.Id);
 }
 public void Register(DtoProfile newProfile)
 {
     new ModelProfileService().Register(newProfile);
 }
Пример #8
0
 public ProductControllerTest()
 {
     _productsService   = new ProductsServiceFake();
     _productController = new ProductController(_productsService, DtoProfile.CreateMapper());
 }
Пример #9
0
 public IEnumerable <DtoFeed> GetFeed(DtoProfile profile)
 {
     return(this.modelFeedService.GetFeed());
 }