public async Task <IActionResult> PutDownloadSection([FromRoute] int id, [FromBody] DownloadSection downloadSection) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != downloadSection.Id) { return(BadRequest()); } _context.Entry(downloadSection).State = EntityState.Modified; foreach (var p in downloadSection.Paragraphs) { _context.Entry(p).State = EntityState.Modified; } try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!DownloadSectionExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <IActionResult> PutSocialType([FromRoute] int id, [FromBody] SocialType socialType) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != socialType.Id) { return(BadRequest()); } _context.Entry(socialType).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!SocialTypeExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <IActionResult> PutWebSiteInfo(int id, WebSiteInfo webSiteStatistics) { if (id != webSiteStatistics.Id) { return(BadRequest()); } _context.Entry(webSiteStatistics).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!WebSiteInfoExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public ActionResult Edit(Person person) { if (ModelState.IsValid) { db.Entry(person).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(person)); }