public IActionResult Put(int id, WebApiLink apiLink) { var updatedLink = (Link)apiLink; updatedLink.Id = id; _context.Entry(updatedLink).State = EntityState.Modified; _context.SaveChanges(); return(Ok(new { action = "updated" })); }
public IHttpActionResult EditLink(int id, LinkDto linkDto) { var clientLink = (Link)linkDto; clientLink.Id = id; db.Entry(clientLink).State = EntityState.Modified; db.SaveChanges(); return(Ok(new { action = "updated" })); }
public IHttpActionResult Put(int id, Task task) { try { if (ModelState.IsValid) { task.id = id; db.Entry(task).State = EntityState.Modified; db.SaveChanges(); return(Json(GanttResponseHelper.GetResult("updated", null))); } } catch (Exception) { } return(Json(GanttResponseHelper.GetResult("error", null))); }
/// <summary> /// Update gantt tasks /// </summary> /// <param name="ganttData">GanttData object</param> private void UpdateTasks(GanttRequest ganttData) { switch (ganttData.Action) { case GanttAction.Inserted: // add new gantt task entity db.Tasks.Add(ganttData.UpdatedTask); break; case GanttAction.Deleted: // remove gantt tasks db.Tasks.Remove(db.Tasks.Find(ganttData.SourceId)); break; case GanttAction.Updated: // update gantt task db.Entry(db.Tasks.Find(ganttData.UpdatedTask.Id)).CurrentValues.SetValues(ganttData.UpdatedTask); break; default: ganttData.Action = GanttAction.Error; break; } }
public IHttpActionResult EditTask(int id, TaskDto taskDto) { var updatedTask = (Task)taskDto; updatedTask.Id = id; if (!string.IsNullOrEmpty(taskDto.target)) { // reordering occurred this._UpdateOrders(updatedTask, taskDto.target); } db.Entry(updatedTask).State = EntityState.Modified; db.SaveChanges(); return(Ok(new { action = "updated" })); }
private void _UpdateLink(GanttContext db, HttpContext context) { var form = context.Request.Params; var id = int.Parse((string)context.Request.RequestContext.RouteData.Values["id"]); var linkDto = new LinkDto { id = id, type = form["type"], source = int.Parse(form["source"]), target = int.Parse(form["target"]), }; var clientLink = (Link)linkDto; db.Entry(clientLink).State = EntityState.Modified; db.SaveChanges(); _Response(new { action = "updated" }, context); }
public void Update(Resource student) { context.Entry(student).State = EntityState.Modified; }
public void Update(Task student) { context.Entry(student).State = EntityState.Modified; }