Example #1
0
        public async Task <IActionResult> Create([Bind("Id,Model,FuelConsumptionPer100Km,TakeoffFuelConsumption")] Plane plane)
        {
            if (ModelState.IsValid)
            {
                var result = await _repository.CreateOrUpdate(plane);

                if (result == null)
                {
                    return(RedirectToAction(nameof(Index)));
                }

                return(RedirectToAction(nameof(Details), new { id = result }));
            }
            return(View(plane));
        }
Example #2
0
        public async Task <IActionResult> OnPostAsync()
        {
            if (!ModelState.IsValid)
            {
                return(Page());
            }

            var result = await _repository.CreateOrUpdate(Plane);

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

            return(RedirectToPage("./Details", new { id = result }));
        }