Пример #1
0
 public decimal CreateCounter(BusinessEntities.CounterEntity counterEntity)
 {
     using (var scope = new TransactionScope())
     {
         var client = new Counter
         {
             createDate = counterEntity.createDate,
             counts     = counterEntity.counts
         };
         _unitOfWork.CounterRepository.Insert(client);
         _unitOfWork.Save();
         scope.Complete();
         return(Convert.ToDecimal(client.sno));
     }
 }
Пример #2
0
        public bool UpdateCounter(int id, BusinessEntities.CounterEntity clientCounterEntity)
        {
            var success = false;

            if (clientCounterEntity != null)
            {
                using (var scope = new TransactionScope())
                {
                    var client = _unitOfWork.CounterRepository.GetByID(id);
                    if (client != null)
                    {
                        client.counts     = clientCounterEntity.counts;
                        client.createDate = clientCounterEntity.createDate;

                        _unitOfWork.CounterRepository.Update(client);
                        _unitOfWork.Save();
                        scope.Complete();
                        success = true;
                    }
                }
            }
            return(success);
        }