public IHttpActionResult Delete(int id)
 {
     try
     {
         var task = db.Tasks.Find(id);
         db.Tasks.Remove(task);
         db.SaveChanges();
         return(Json(GanttResponseHelper.GetResult("deleted", null)));
     }
     catch (Exception) { }
     return(Json(GanttResponseHelper.GetResult("error", null)));
 }
Beispiel #2
0
 public IHttpActionResult Post(TSSTaskLog tasks)
 {
     try
     {
         if (ModelState.IsValid)
         {
             db.TSSTasks.Add(tasks);
             db.SaveChanges();
             return(Json(GanttResponseHelper.GetResult("inserted", tasks.TaskID)));
         }
     }
     catch (Exception) { }
     return(Json(GanttResponseHelper.GetResult("error", null)));
 }
 public IHttpActionResult Post(Link link)
 {
     try
     {
         if (ModelState.IsValid)
         {
             db.Links.Add(link);
             db.SaveChanges();
             return(Json(GanttResponseHelper.GetResult("inserted", link.id)));
         }
     }
     catch (Exception) { }
     return(Json(GanttResponseHelper.GetResult("error", null)));
 }
 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)));
 }
        public IHttpActionResult Post(Task task)
        {
            short       grID    = 0;
            HttpContext context = HttpContext.Current;

            try
            {
                if (ModelState.IsValid)
                {
                    db.Tasks.Add(task);
                    db.SaveChanges();
                    grID = sup.grID();
                    sup.groupTaskAdd(grID, task.id);

                    return(Json(GanttResponseHelper.GetResult("inserted", task.id)));
                }
            }
            catch (Exception) { }

            return(Json(GanttResponseHelper.GetResult("error", null)));
        }