Beispiel #1
0
        public void AddLandOwner(LandOwner o, int farmerId)
        {
            using (var scope = new TransactionScope())
            {
                farmerVersionRepo.UpdateWhatWhere(new { EndDate = DateTime.Now }, new { farmerId, EndDate = DBNull.Value });

                o.FarmerVersionId = farmerVersionRepo.Insert(new FarmerVersion { FarmerId = farmerId, StartDate = DateTime.Now });
                landOwnerRepo.Insert(o);

                scope.Complete();
            }
        }
Beispiel #2
0
        public int CreateLandOwner(LandOwner o)
        {
            using (var scope = new TransactionScope())
            {
                var farmerId = farmerRepo.Insert(new Farmer { FType = FarmerType.LandOwner });
                var v = new FarmerVersion
                            {
                                FarmerId = farmerId,
                                StartDate = DateTime.Now
                            };

                o.FarmerVersionId = farmerVersionRepo.Insert(v);

                landOwnerRepo.Insert(o);

                scope.Complete();
                return farmerId;
            }
        }