Ejemplo n.º 1
0
 public int Insert(TwitterApp entity)
 {
     using (_connection = Utilities.Database.GetProfiledOpenConnection())
     {
         return _connection.Insert(entity).Value;
     }
 }
Ejemplo n.º 2
0
 public Holiday Insert(Holiday entity)
 {
     using (_connection = Utilities.GetProfiledOpenConnection())
     {
         entity.Id = _connection.Insert(entity);
         return entity;
     }
 }
 public RestaurantRating Insert(RestaurantRating entity)
 {
     using (_connection = Utilities.GetProfiledOpenConnection())
     {
         var insert = _connection.Insert(entity);
         entity.Id = (int)insert;
         return entity;
     }
 }
Ejemplo n.º 4
0
 public ActionResult Create(CarViewModel model)
 {
     if (ModelState.IsValid)
     {
         using (_connection = Utilities.GetOpenConnection())
         {
             _connection.Insert(model);
         }
         return RedirectToAction("index");
     }
     return View(model);
 }
Ejemplo n.º 5
0
 public ActionResult Create(UserAddEdit viewmodel)
 {
     if (ModelState.IsValid)
     {
         //manual mapping - this would be easier with automapper
         var user = UserAddEdit.MapUserAddEditToUser(viewmodel);
         using (_connection = Utilities.GetOpenConnection())
         {
             _connection.Insert(user);
         }
         return RedirectToAction("index");
     }
     return View(viewmodel);
 }
Ejemplo n.º 6
0
 public Job SaveOrUpdate(Job entity)
 {
     using (_connection = Utilities.GetProfiledOpenConnection())
     {
         if (entity.Id > 0)
         {
             entity.Id =_connection.Update(entity);
         }
         else
         {
              entity.Id = _connection.Insert(entity);
         }
         return entity;
     }
 }
 public RestaurantOption SaveOrUpdate(RestaurantOption entity)
 {
     using (_connection = Utilities.GetProfiledOpenConnection())
     {
         if (entity.Id > 0)
         {
             _connection.Update(entity);
         }
         else
         {
             int insert = _connection.Insert(entity);
             entity.Id = insert;
         }
         return entity;
     }
 }
 public RestaurantType SaveOrUpdate(RestaurantType entity)
 {
     using (_connection = Utilities.GetProfiledOpenConnection())
     {
         if (entity.Id > 0)
         {
             entity.Id = _connection.Update(entity);
         }
         else
         {
             var insert = _connection.Insert(entity);
                 entity.Id = (int)insert;
         }
         return entity;
     }
 }
Ejemplo n.º 9
0
 public JobLog SaveOrUpdate(JobLog entity)
 {
     using (_connection = Utilities.GetProfiledOpenConnection())
     {
         if (entity.JobLogId > 0)
         {
             entity.JobLogId = _connection.Update(entity);
         }
         else
         {
             var insert = _connection.Insert(entity);
                 entity.JobLogId = (int)insert;
         }
         return entity;
     }
 }
Ejemplo n.º 10
0
 private static void Insert(DbConnection db, ISagaState data, string correlationId)
 {
     try
     {
         db.Insert(new SagaRow()
         {
             SagaId = SagaRow.GetId(correlationId, data.GetType()),
             Data = data.Serialize().ToByteArray(),
             IsCompleted = false,
             LastChangedOn = DateTime.UtcNow,
             Version = data.AutoTimestamp
         });
     }
     catch (DbException ex)
     {
         if (db.IsUniqueViolation(ex)) throw new SagaExistsException();
      
     }
 }
Ejemplo n.º 11
0
 public Vote SaveOrUpdate(Vote entity)
 {
     using (_connection = Utilities.GetProfiledOpenConnection())
     {
         if (entity.Id == 0)
             entity.Id = _connection.Insert(entity);
         else
             _connection.Update(entity);
     }
     return entity;
 }
Ejemplo n.º 12
0
 public int Insert(DBVersion entity)
 {
     using (_connection = Utilities.GetProfiledOpenConnection())
     {
         return _connection.Insert(entity);
     }
 }