public virtual int Add(PackageTransactions packageTransactions) { // PackageTransactions packageTransactions = new PackageTransactions(); // packageTransactions.PackageId = package.PackageId; return 1; }
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; }
public int Update(PackageTransactions PackageTransactions) { PackageTransactionModel = (PackageTransactions)PackageTransactions; PackageTransactionsServices.Update(PackageTransactionModel); return PackageTransactionModel.PackageTransactionsId; }
public int Delete(PackageTransactions PackageTransactions) { PackageTransactionsServices.Delete(PackageTransactions); return PackageTransactions.PackageTransactionsId; }
public PackageTransactionsContracts() { PackageTransactionModel = new PackageTransactions(); PackageTransactionsServices = new PackageTransactionsServices(); }
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; }
public virtual int Delete(PackageTransactions packageTransactions) { Context.PackageTransactionses.Remove(packageTransactions); Context.SaveChanges(); return packageTransactions.PackageTransactionsId; }