public async Task SendEditCity(City city) { _cityDbContext.Entry(city).State = EntityState.Modified; await _cityDbContext.SaveChangesAsync(); await Clients.All.SendAsync("ReceiveEditCity", city); }
public async Task <IActionResult> Put(int id, City city) { if (id != city.CityId) { return(BadRequest()); } _context.Entry(city).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!_context.Cities.Any(e => e.CityId == id)) { return(NotFound()); } else { throw; } } return(Ok()); }
public ActionResult Edit([Bind(Include = "Id,Name,Email")] Student student) { if (ModelState.IsValid) { db.Entry(student).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(student)); }