Beispiel #1
0
 public void Update(TwitterApp entity)
 {
     using (_connection = Utilities.Database.GetProfiledOpenConnection())
     {
         _connection.Update(entity);
     }
 }
        public ActionResult Edit(CarViewModel model)
        {
            if (ModelState.IsValid)
            {
                using (_connection = Utilities.GetOpenConnection())
                {
                    _connection.Update(model);
                }
                return RedirectToAction("index");
            }

            return View(model);
        }
        public ActionResult Edit(UserAddEdit viewmodel)
        {
            if (ModelState.IsValid)
            {
                using (_connection = Utilities.GetOpenConnection())
                {
                    _connection.Update(UserAddEdit.MapUserAddEditToUser(viewmodel));
                }
                return RedirectToAction("index");
            }

            return View(viewmodel);
        }
Beispiel #4
0
        private static void Update(DbConnection db, ISagaState data, string correlationId)
        {
            var old = data.AutoTimestamp;
            var result=db.Update<SagaRow>()
                .Set(d => d.Data, data.Serialize().ToByteArray())
                .Set(d => d.Version,data.AutoTimestamp)
                .Set(d => d.LastChangedOn, DateTime.UtcNow)
                .Set(d => d.IsCompleted, data.IsCompleted)
                .Where(d => d.SagaId == SagaRow.GetId(correlationId, data.GetType()) && d.Version == old)
                .Execute();
            if (result!=1) throw new SagaConcurrencyException();

        }
Beispiel #5
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;
     }
 }
 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;
     }
 }
 public Vote SaveOrUpdate(Vote entity)
 {
     using (_connection = Utilities.GetProfiledOpenConnection())
     {
         if (entity.Id == 0)
             entity.Id = _connection.Insert(entity);
         else
             _connection.Update(entity);
     }
     return entity;
 }
Beispiel #10
0
        public User Update(User entity)
        {
            using (_connection = Utilities.GetProfiledOpenConnection())
            {
                _connection.Update(entity);

                return entity;
            }
        }