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"
            }));
        }
示例#2
0
        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"
            }));
        }
示例#3
0
 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)));
 }
示例#4
0
        /// <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;
            }
        }
示例#5
0
        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"
            }));
        }
示例#6
0
        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);
        }
示例#7
0
 public void Update(Resource student)
 {
     context.Entry(student).State = EntityState.Modified;
 }
示例#8
0
 public void Update(Task student)
 {
     context.Entry(student).State = EntityState.Modified;
 }