Exemple #1
0
        public void Add(ref TD entity)
        {
            TS SourceEntity = ConvertToSourceType(entity);

            _context.Set <TS>().Add(SourceEntity);
            _context.SaveChanges();
            entity = ConvertToDestinationType(SourceEntity);
        }
Exemple #2
0
 public DTO.Product Add(DataAccessLayer.Product product)
 {
     using (var db = new LNBagShopDBEntities())
     {
         var returnEntity = db.Products.Add(product);
         var config       = new MapperConfiguration(cfg =>
         {
             cfg.AddProfile(new MappingProfile());
         });
         var mapper  = config.CreateMapper();
         var return1 = mapper.Map <DataAccessLayer.Product, DTO.Product>(returnEntity);
         db.SaveChanges();
         return(return1);
     }
 }
Exemple #3
0
 public int Save()
 {
     return(_context.SaveChanges());
 }