예제 #1
0
        public async Task <IActionResult> Edit(int id, AquariumFormModel model)
        {
            if (!ModelState.IsValid)
            {
                return(View(model));
            }

            await this.aquariums.EditAsync(
                id,
                model.Title,
                model.Length,
                model.Width,
                model.Height,
                model.Description,
                model.ImageUrl);

            return(RedirectToAction(nameof(AquariumsController.Details), "Aquariums", new { id }));
        }
예제 #2
0
        public async Task <IActionResult> Create(AquariumFormModel model)
        {
            if (!ModelState.IsValid)
            {
                return(View(model));
            }

            await this.aquariums.CerateAsync(
                model.Title,
                model.Length,
                model.Width,
                model.Height,
                model.Description,
                model.ImageUrl,
                this.userManager.GetUserId(User));

            return(RedirectToAction(nameof(AquariumsController.All), "Aquariums", new { area = string.Empty }));
        }