Esempio n. 1
0
        public async Task <IActionResult> PutDailypoGroupReport([FromRoute] string id, [FromBody] DailypoGroupReport dailypoGroupReport)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != dailypoGroupReport.GroupCode)
            {
                return(BadRequest());
            }

            _context.Entry(dailypoGroupReport).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!DailypoGroupReportExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
Esempio n. 2
0
        public async Task <IActionResult> PutDailypoProductTeam([FromRoute] int id, [FromBody] DailypoProductTeam dailypoProductTeam)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != dailypoProductTeam.GptId)
            {
                return(BadRequest());
            }

            _context.Entry(dailypoProductTeam).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!DailypoProductTeamExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
Esempio n. 3
0
        public async Task <IActionResult> PutSaleproGoodPattn([FromRoute] int id, [FromBody] SaleproGoodPattn saleproGoodPattn)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != saleproGoodPattn.Id)
            {
                return(BadRequest());
            }

            var getGoodPattn = await _context.GetTransactionInv
                               .Where(w => w.GoodPattnCode == saleproGoodPattn.GoodPattnCode)
                               .GroupBy(g => new { g.GoodPattnName })
                               .Select(s => new { s.Key.GoodPattnName })
                               .ToListAsync();

            var getGoodClass = await _context.GetTransactionInv
                               .Where(w => w.GoodClassCode == saleproGoodPattn.GoodClassCode)
                               .GroupBy(g => new { g.GoodClassName })
                               .Select(s => new { s.Key.GoodClassName })
                               .ToListAsync();

            var getSubCodePro = await _context.CodePromotion
                                .Where(w => w.SubId == saleproGoodPattn.SubId)
                                .GroupBy(g => new { g.SubCodePro })
                                .Select(s => new { s.Key.SubCodePro })
                                .ToListAsync();

            saleproGoodPattn.GoodPattnName = getGoodPattn[0].GoodPattnName;
            saleproGoodPattn.GoodClassName = getGoodClass[0].GoodClassName;
            saleproGoodPattn.SubCodePro    = getSubCodePro[0].SubCodePro;

            _context.Entry(saleproGoodPattn).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!SaleproGoodPattnExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
        public async Task <IActionResult> PutGoodCateCode([FromRoute] int id, [FromBody] GoodCateCode goodCateCode)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != goodCateCode.Id)
            {
                return(BadRequest());
            }

            var getProduct = await _context.GetTransactionInv
                             .Where(w => w.ProductCode == goodCateCode.GoodCatecode)
                             .GroupBy(g => new { g.Product })
                             .Select(s => new { s.Key.Product })
                             .ToListAsync();

            var getSubCodePro = await _context.CodePromotion
                                .Where(w => w.SubId == goodCateCode.SubId)
                                .GroupBy(g => new { g.SubCodePro })
                                .Select(s => new { s.Key.SubCodePro })
                                .ToListAsync();

            goodCateCode.GoodCateName = getProduct[0].Product;
            goodCateCode.SubCodePro   = getSubCodePro[0].SubCodePro;

            _context.Entry(goodCateCode).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!GoodCateCodeExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
        public async Task <IActionResult> PutListProductPromotion([FromRoute] int id, [FromBody] ListProductPromotion listProductPromotion)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != listProductPromotion.Id)
            {
                return(BadRequest());
            }

            var getCode = await _context.GetTransactionInv
                          .Where(w => w.GoodId == listProductPromotion.GoodId)
                          .GroupBy(g => new { g.GoodCode })
                          .Select(s => new { s.Key.GoodCode })
                          .ToListAsync();

            var getSubCodePro = await _context.CodePromotion
                                .Where(w => w.SubId == listProductPromotion.SubId)
                                .GroupBy(g => new { g.SubCodePro })
                                .Select(s => new { s.Key.SubCodePro })
                                .ToListAsync();

            listProductPromotion.GoodCode   = getCode[0].GoodCode;
            listProductPromotion.SubCodePro = getSubCodePro[0].SubCodePro;

            _context.Entry(listProductPromotion).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!ListProductPromotionExists(id.ToString()))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }