Ejemplo n.º 1
0
 public DropDTO Insert(DropDTO drop)
 {
     using (var context = DataAccessHelper.CreateContext())
     {
         Drop entity = _mapper.Map <Drop>(drop);
         context.Drop.Add(entity);
         context.SaveChanges();
         return(_mapper.Map <DropDTO>(drop));
     }
 }
Ejemplo n.º 2
0
 public void Insert(List <DropDTO> drops)
 {
     using (var context = DataAccessHelper.CreateContext())
     {
         context.Configuration.AutoDetectChangesEnabled = false;
         foreach (DropDTO Drop in drops)
         {
             Drop entity = _mapper.Map <Drop>(Drop);
             context.Drop.Add(entity);
         }
         context.Configuration.AutoDetectChangesEnabled = true;
         context.SaveChanges();
     }
 }
Ejemplo n.º 3
0
 public DropDTO Insert(DropDTO drop)
 {
     try
     {
         using (var context = DataAccessHelper.CreateContext())
         {
             Drop entity = _mapper.Map <Drop>(drop);
             context.Drop.Add(entity);
             context.SaveChanges();
             return(_mapper.Map <DropDTO>(drop));
         }
     }
     catch (Exception e)
     {
         Logger.Error(e);
         return(null);
     }
 }