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

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

            return(this.View(model));
        }
Ejemplo n.º 2
0
        public async Task <IActionResult> Create(AddLocationPostModel 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.locationInfoService.CreateDetailedAsync(
                apiaryId, input.Settlement, input.Altitude, input.HasHoneyPlants, input.Description);

            return(this.RedirectToAction(nameof(ViewAll)));
        }