Пример #1
0
 public int Post(GreenBlend greenBlend)
 {
     greenBlend.StockItem = _context.Stocks.FirstOrDefault(x => x.Id == greenBlend.StockItem.Id);
     _context.Add <GreenBlend>(greenBlend);
     _context.SaveChanges();
     return(greenBlend.Id);
 }
Пример #2
0
 public int Post(Stock stock)
 {
     stock.GreenBeanInfo = _context.GreenBeanInfos.FirstOrDefault(x => x.Id == stock.GreenBeanInfo.Id);
     stock.SellerContact = _context.Contacts.FirstOrDefault(x => x.Id == stock.SellerContact.Id);
     _context.Add <Stock>(stock);
     _context.SaveChanges();
     return(stock.Id);
 }
Пример #3
0
        public int Post(Roast roast)
        {
            if (roast.CuppingInfo != null)
            {
                roast.CuppingInfo = _context.Cuppings.FirstOrDefault(x => x.Id == roast.CuppingInfo.Id);
            }
            List <GreenBlend> blend = new List <GreenBlend>();

            roast.Beans.ForEach(x => blend.Add(_context.GreenBlends.FirstOrDefault(k => k.Id == x.Id)));
            roast.Beans.Clear();
            roast.Beans.AddRange(blend);
            _context.Add <Roast>(roast);
            _context.SaveChanges();
            return(roast.Id);
        }
Пример #4
0
 public int Post(Cupping cupping)
 {
     _context.Add <Cupping>(cupping);
     _context.SaveChanges();
     return(cupping.Id);
 }
 public int Post(GreenBeanInfo greenBeanInfo)
 {
     _context.Add <GreenBeanInfo>(greenBeanInfo);
     _context.SaveChanges();
     return(greenBeanInfo.Id);
 }
Пример #6
0
 public Int64 Post(Contact contact)
 {
     _context.Add <Contact>(contact);
     _context.SaveChanges();
     return(contact.Id);
 }