コード例 #1
0
        public virtual int Add(PackageTransactions packageTransactions)
        {
            //  PackageTransactions packageTransactions = new PackageTransactions();
            // packageTransactions.PackageId = package.PackageId;

            return 1;
        }
コード例 #2
0
        public virtual int AddTransaction(Package package, string username)
        {
            PackageTransactions packageTransactions = new PackageTransactions();
            //update the package status
            package.PackageStatusId = 5;
            var packageModel = Context.Packages.First(x => x.BarcodeId == package.BarcodeId);
            packageModel.PackageStatusId = 5;
            packageModel.PackageStatus =
            Context.PackageStatuses.First(x => x.PackageStatusId == packageModel.PackageStatusId);
            package.PackageId = packageModel.PackageId;
            packageTransactions.PackageId = package.PackageId;
            //Add the packagetransaction
            var userDetails = Context.Users.First(x => x.UserName == username);
            packageTransactions.SentBy = userDetails;
            packageTransactions.SentOn = DateTime.Now;
            packageTransactions.ToLocId = package.CurrentLocationId;
            packageTransactions.FromLocId = userDetails.DistributionCenterId;
            packageTransactions.Package = Context.Packages.First(x => x.PackageId == packageTransactions.PackageId);
            packageTransactions.BarcodeId = packageTransactions.Package.BarcodeId;

            var id = Context.PackageTransactionses.Add(packageTransactions);
            Context.SaveChanges();
            return id.PackageTransactionsId;
        }
コード例 #3
0
 public int Update(PackageTransactions PackageTransactions)
 {
     PackageTransactionModel = (PackageTransactions)PackageTransactions;
     PackageTransactionsServices.Update(PackageTransactionModel);
     return PackageTransactionModel.PackageTransactionsId;
 }
コード例 #4
0
 public int Delete(PackageTransactions PackageTransactions)
 {
     PackageTransactionsServices.Delete(PackageTransactions);
     return PackageTransactions.PackageTransactionsId;
 }
コード例 #5
0
 public PackageTransactionsContracts()
 {
     PackageTransactionModel = new PackageTransactions();
     PackageTransactionsServices = new PackageTransactionsServices();
 }
コード例 #6
0
        public virtual int Update(PackageTransactions packageTransactions)
        {
            AutoMapper.Mapper.CreateMap<PackageTransactions, PackageTransactions>();
            var packagetr =
                Context.PackageTransactionses.First(
                    x => x.PackageTransactionsId == packageTransactions.PackageTransactionsId);

            var mapped = AutoMapper.Mapper.Map<PackageTransactions>(packagetr);
            Context.SaveChanges();
            return mapped.PackageTransactionsId;
        }
コード例 #7
0
 public virtual int Delete(PackageTransactions packageTransactions)
 {
     Context.PackageTransactionses.Remove(packageTransactions);
     Context.SaveChanges();
     return packageTransactions.PackageTransactionsId;
 }