Ejemplo n.º 1
0
        public IActionResult Create()
        {
            var userId = this.userManager.GetUserId(this.User);

            var model = new AddBeehivePostModel()
            {
                AllApairies = this.apiaryService.GetAll(userId),
            };

            return(this.View(model));
        }
Ejemplo n.º 2
0
        public async Task <IActionResult> CreateAsync(AddBeehivePostModel input)
        {
            var userId   = this.userManager.GetUserId(this.User);
            var apiaryId = input.SelectedApiary;

            if (ModelState.IsValid == false)
            {
                input.AllApairies = this.apiaryService.GetAll(userId);
                return(this.View(input));
            }

            await this.beehiveService.CreateAsync(
                apiaryId, input.Number, input.SystemType, input.BeehiveType);

            return(this.RedirectToAction("Index", "Home"));
        }