Exemple #1
0
        public bool InsertPackage(SharedDataTypes.Package p)
        {
            localDb.Package.Add(converter.ConvertToDBPackage(p));
            int cnt = 1;

            foreach (var item in p.Chocolates)
            {
                cnt++;
                localDb.Package_has_Chocolate.Add(converter.ConvertToDBPackageHasChoco(item.ChocolateId, p.PackageId));
            }
            return(localDb.SaveChanges() == cnt);
        }
Exemple #2
0
 public DataBases.Package ConvertToDBPackage(SharedDataTypes.Package p)
 {
     return(new DataBases.Package
     {
         ID_Package = p.PackageId,
         Name = p.Name,
         Descripton = p.Description,
         WrappingID = p.Wrapping.WrappingId,
         Availability = p.Available,
         Customer_ID = p.Customer.CustomerId,
         Image = p.Image,
         ModifyDate = DateTime.Now,
         Wrapping = p.Wrapping.Name
     });
 }
Exemple #3
0
        public bool UpdatePackage(SharedDataTypes.Package p)
        {
            var temp = localDb.Package.Where(q => q.ID_Package.Equals(q.ID_Package)).Select(q => q).First();

            temp.Name         = p.Name;
            temp.Descripton   = p.Description;
            temp.WrappingID   = p.Wrapping.WrappingId;
            temp.Availability = p.Available;
            temp.Customer_ID  = p.Customer.CustomerId;
            temp.Wrapping     = p.Wrapping.Name;
            temp.Image        = p.Image;
            temp.ModifyDate   = DateTime.Now;

            return(localDb.SaveChanges() == 1);
        }
 internal Local_Database.OrderContent_has_Package ConvertToDBOcHasPackage(SharedDataTypes.OrderContent oc, SharedDataTypes.Package p)
 {
     return(new OrderContent_has_Package
     {
         OrderContent_ID = oc.OrderContentId,
         Amount = oc.Amount,
         Package_ID = p.PackageId,
         ModifyDate = DateTime.Now
     });
 }