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)); } }
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); }