Пример #1
0
        public async Task <IActionResult> AddTape(BaseMaterialViewModel model)
        {
            if (!ModelState.IsValid)
            {
                return(View(model));
            }

            await this.materials.AddTapeAsync(
                model.Date,
                model.Price,
                model.SafetyMargin);

            return(RedirectToAction(nameof(AllTape)));
        }
Пример #2
0
        public async Task <IActionResult> EditTape(int id, BaseMaterialViewModel model)
        {
            if (!ModelState.IsValid)
            {
                return(View(model));
            }

            var success = await this.materials.EditTapeAsync(
                id,
                model.Date,
                model.Price,
                model.SafetyMargin);

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

            return(RedirectToAction(nameof(AllTape)));
        }