コード例 #1
0
        public async Task <IActionResult> EditSpecialOffer_inmem(int specialOfferID, [FromBody] Sales.SpecialOffer_inmem value)
        {
            var existing = await _db.Sales_SpecialOffer_inmem.FirstOrDefaultAsync(x => x.SpecialOfferID == specialOfferID);

            if (existing == null)
            {
                return(NotFound());
            }

            existing.SpecialOfferID = value.SpecialOfferID;
            existing.Description    = value.Description;
            existing.DiscountPct    = value.DiscountPct;
            existing.Type           = value.Type;
            existing.Category       = value.Category;
            existing.StartDate      = value.StartDate;
            existing.EndDate        = value.EndDate;
            existing.MinQty         = value.MinQty;
            existing.MaxQty         = value.MaxQty;
            existing.ModifiedDate   = value.ModifiedDate;

            _db.Sales_SpecialOffer_inmem.Update(existing);
            await _db.SaveChangesAsync();

            return(NoContent());
        }
コード例 #2
0
        public async Task <IActionResult> CreateSpecialOffer_inmem([FromBody] Sales.SpecialOffer_inmem value)
        {
            _db.Sales_SpecialOffer_inmem.Add(value);
            await _db.SaveChangesAsync();

            return(Ok(value));
        }