コード例 #1
0
        public async Task <IActionResult> EditPaperWaste(int id, PaperWasteViewModel model)
        {
            if (!ModelState.IsValid)
            {
                return(View(model));
            }

            var success = await this.materials.EditPaperWasteAsync(
                id,
                model.Date,
                model.CoreWaste,
                model.PrintingWaste,
                model.Key1,
                model.Value1,
                model.Key2,
                model.Value2,
                model.Key3,
                model.Value3,
                model.Key4,
                model.Value4,
                model.Key5,
                model.Value5);

            if (!success)
            {
                return(NotFound());
            }

            return(RedirectToAction(nameof(AllPaperWaste)));
        }
コード例 #2
0
        public async Task <IActionResult> AddPaperWaste(PaperWasteViewModel model)
        {
            if (!ModelState.IsValid)
            {
                return(View(model));
            }

            await this.materials.AddPaperWasteAsync(
                model.Date,
                model.CoreWaste,
                model.PrintingWaste,
                model.Key1,
                model.Value1,
                model.Key2,
                model.Value2,
                model.Key3,
                model.Value3,
                model.Key4,
                model.Value4,
                model.Key5,
                model.Value5);

            return(RedirectToAction(nameof(AllPaperWaste)));
        }