protected Mapper CreateMapperProfile() { var myProfile = new DtoProfile(); var configuration = new MapperConfiguration(cfg => cfg.AddProfile(myProfile)); return(new Mapper(configuration)); }
protected override void ConfigureMapper(IMapperConfigurationExpression cfg) { Profile profile = new DtoProfile(); base.ConfigureMapper(cfg); profile.AddDataRecordMember(); cfg.AddProfile(profile); }
// 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" }); }); }
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(); }
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); }
public object ProfileUpsert([FromBody] DtoProfile profile) { _Profile.Upsert(profile); return(profile.Id); }
public void Register(DtoProfile newProfile) { new ModelProfileService().Register(newProfile); }
public ProductControllerTest() { _productsService = new ProductsServiceFake(); _productController = new ProductController(_productsService, DtoProfile.CreateMapper()); }
public IEnumerable <DtoFeed> GetFeed(DtoProfile profile) { return(this.modelFeedService.GetFeed()); }