public async Task <IActionResult> Edit(int id, [Bind("Id,Name,Icon,Url")] Social social) { if (id != social.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(social); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!SocialExists(social.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(social)); }
public async Task <IActionResult> Edit(int id, [Bind("Id,Title,Slug,Text,Author,Date,Photo")] Blog blog) { if (id != blog.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(blog); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!BlogExists(blog.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(blog)); }
public async Task <IActionResult> Edit(int id, [Bind("Id,Address,Email,PhoneNumber")] Setting setting) { if (id != setting.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(setting); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!SettingExists(setting.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(setting)); }
public bool Update(Agency model) { try { var originalModel = _agencyDbContext.Agency.Single(x => x.Id == model.Id ); originalModel.Name = model.Name; originalModel.Status = model.Status; originalModel.City = model.City; originalModel.State = model.State; _agencyDbContext.Update(originalModel); _agencyDbContext.SaveChanges(); } catch (System.Exception) { return(false); } return(true); }