public async Task <IHttpActionResult> PutMarkerModel(int id, MarkerModel markerModel) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != markerModel.Id) { return(BadRequest()); } db.Entry(markerModel).State = EntityState.Modified; try { await db.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!MarkerModelExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public ActionResult Edit([Bind(Include = "Id,Type,Latitude,Longitude,Status,Location,Description,IsControllable,IsWorking")] MarkerModel markerModel) { var types = GetAllTypes(); var statuses = GetStatus(); markerModel.Types = GetSelectListItems(types); markerModel.Statuses = GetSelectListItems(statuses); if (ModelState.IsValid) { db.Entry(markerModel).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("SaveToFirebase", new { mId = markerModel.Id })); } return(View(markerModel)); }