public async Task <IActionResult> Edit(int id, [Bind("ID,CompanyName,Telephone,JobName,JobCategoryId,SubCategoryId,JobLocation,Salary,Description,Summary")] Jobs jobs) { if (id != jobs.ID) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(jobs); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!JobsExists(jobs.ID)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["JobCategoryId"] = new SelectList(_context.Category, "Id", "Name", jobs.JobCategoryId); ViewData["JobLocation"] = new SelectList(_context.Set <JobLocation>(), "Id", "CityName", jobs.JobLocation); ViewData["SubCategoryId"] = new SelectList(_context.SubCategory, "Id", "Name", jobs.SubCategoryId); return(View(jobs)); }
public IActionResult Editar(Comment comment) { _context.Update(comment); _context.SaveChanges(); return(RedirectToAction("Details", "Post", new { id = comment.PostId })); }
public async Task <IActionResult> Edit(int id, JobCategory category) { if (id != category.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(category); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!CategoryExists(category.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(category)); }
public async Task <IActionResult> Edit(int id, [Bind("ID,Title,Content,CreateTime,ImageUrl")] Blogposts blogposts) { if (id != blogposts.ID) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(blogposts); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!BlogpostsExists(blogposts.ID)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(blogposts)); }
public async Task <IActionResult> Edit(int id, [Bind("Id,FirstName,LastName,Username,Password,StreetAdress,PostNumber,City,Country,Email,Currency,CreatedAt,PhoneNumber")] User user) { if (id != user.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(user); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!UserExists(user.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(user)); }
public IActionResult Editar(Post post) { _context.Update(post); _context.SaveChanges(); return(RedirectToAction("Index")); }