public IActionResult Create(int id) { var viewModel = new CreateApiaryNoteInputModel(); var apiary = this.apiaryService.GetApiaryById <ApiaryDataModel>(id); viewModel.ApiaryId = id; viewModel.ApiaryNumber = apiary.Number; viewModel.ApiaryName = apiary.Name; return(this.View(viewModel)); }
public async Task <IActionResult> Edit(int id, CreateApiaryNoteInputModel inputModel) { var currentUser = await this.userManager.GetUserAsync(this.User); if (!this.ModelState.IsValid) { return(this.View(inputModel)); } var apiaryId = await this.apiaryNoteService.EditAsync( id, inputModel.Title, inputModel.Content, inputModel.Color, currentUser.Id); this.TempData[GlobalConstants.SuccessMessage] = $"Успешно редактирахте бележката бележка на пчелина!"; return(this.RedirectToAction("AllByApiaryId", "ApiaryNote", new { id = apiaryId })); }