public async Task <IActionResult> Edit(int id, [Bind("ID,Name,DateOfBirth,Notes")] Professor professor) { if (id != professor.ID) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(professor); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ProfessorExists(professor.ID)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(professor)); }
public async Task <IActionResult> Edit(int id, [Bind("ID,Name,Content,UniversityID")] StudyPlan studyPlan) { if (id != studyPlan.ID) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(studyPlan); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!StudyPlanExists(studyPlan.ID)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["UniversityID"] = new SelectList(_context.Universities, "ID", "ID", studyPlan.UniversityID); return(View(studyPlan)); }
public async Task <IActionResult> Edit(Guid id, [Bind("Id,BarId,UserId,Rating,Comment,DeletedOn,ReviewedOn")] BarReview barReview) { if (id != barReview.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(barReview); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!BarReviewExists(barReview.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["BarId"] = new SelectList(_context.Bars, "Id", "Address", barReview.BarId); ViewData["UserId"] = new SelectList(_context.Users, "Id", "Email", barReview.UserId); return(View(barReview)); }
public async Task <IActionResult> Edit(int id, [Bind("ID,Name,Description")] University university) { if (id != university.ID) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(university); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!UniversityExists(university.ID)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(university)); }
public async Task <string> EditIngredienAsync(IngredientDTO ingredientDto) //tested -1 { ingredientDto.ValidateIfNull(ExceptionMessages.IngredientDtoNull); var ingredient = ingredientDto.MapToCtxModel(); ingredient.ValidateIfNull(ExceptionMessages.IngredientNull); _context.Update(ingredient); await _context.SaveChangesAsync(); return(ingredient.Name); }