Пример #1
0
        public IHttpActionResult UpdateTask(Task task)
        {
            try
            {
                using (var fsd = new FSDEntities())
                {
                    var  insertItem = fsd.Set <Task>();
                    Task present    = new Task();
                    present = insertItem.Where(x => x.task_id == task.task_id).First();

                    present.Start_Date = task.Start_Date;
                    present.End_Date   = task.End_Date;
                    present.TaskName   = task.TaskName;
                    present.Status     = task.Status;

                    present.Status = "Completed";
                    fsd.SaveChanges();
                    return(Ok());
                }
            }
            catch (Exception ex)
            {
                return(BadRequest(ex.ToString()));
            }
        }
Пример #2
0
 public IHttpActionResult GetUserById(int identity)
 {
     try
     {
         using (
             var fsd = new FSDEntities())
         {
             List <User> items = fsd.Set <User>().ToList();
             return(Ok(items.Where(x => x.user_id == identity).First()));
         }
     }
     catch (Exception ex)
     {
         return(BadRequest(ex.ToString()));
     }
 }
Пример #3
0
 public IHttpActionResult GetTasks()
 {
     try
     {
         using (
             var fsd = new FSDEntities())
         {
             List <Task> items = fsd.Set <Task>().ToList();
             return(Ok(items));
         }
     }
     catch (Exception ex)
     {
         return(BadRequest(ex.ToString()));
     }
 }
Пример #4
0
 public IHttpActionResult DeleteProject(int identity)
 {
     try
     {
         using (var fsd = new FSDEntities())
         {
             var insertItem = fsd.Set <Project>();
             insertItem.Remove(insertItem.Where(x => x.Project_ID == identity).First());
             fsd.SaveChanges();
             return(Ok());
         }
     }
     catch (Exception ex)
     {
         return(BadRequest(ex.ToString()));
     }
 }
Пример #5
0
 public IHttpActionResult AddTask(Task proj)
 {
     try
     {
         using (var fsd = new FSDEntities())
         {
             var insertItem = fsd.Set <Task>();
             insertItem.Add(new Task {
                 parent_id = proj.parent_id, project_ID = proj.project_ID, TaskName = proj.TaskName, Start_Date = proj.Start_Date, End_Date = proj.End_Date, priority = proj.priority
             });
             fsd.SaveChanges();
             return(Ok());
         }
     }
     catch (Exception ex)
     {
         return(BadRequest(ex.ToString()));
     }
 }
Пример #6
0
 public IHttpActionResult AddParentTask(ParentTask proj)
 {
     try
     {
         using (var fsd = new FSDEntities())
         {
             var insertItem = fsd.Set <ParentTask>();
             insertItem.Add(new ParentTask {
                 parent_task = proj.parent_task
             });
             fsd.SaveChanges();
             return(Ok());
         }
     }
     catch (Exception ex)
     {
         return(BadRequest(ex.ToString()));
     }
 }
Пример #7
0
 public IHttpActionResult AddProject(Project proj)
 {
     try
     {
         using (var fsd = new FSDEntities())
         {
             var insertItem = fsd.Set <Project>();
             insertItem.Add(new Project {
                 ProjectName = proj.ProjectName, StartDate = proj.StartDate, EndDate = proj.EndDate, priority = proj.priority
             });
             fsd.SaveChanges();
             return(Ok());
         }
     }
     catch (Exception ex)
     {
         return(BadRequest(ex.ToString()));
     }
 }
Пример #8
0
 public IHttpActionResult AddUser(User usr)
 {
     try
     {
         using (var fsd = new FSDEntities())
         {
             var insertItem = fsd.Set <User>();
             insertItem.Add(new User {
                 FirstName = usr.FirstName.TrimEnd(), Lastname = usr.Lastname.TrimEnd(), Employee_ID = usr.Employee_ID.TrimEnd()
             });
             fsd.SaveChanges();
             return(Ok());
         }
     }
     catch (Exception ex)
     {
         return(BadRequest(ex.ToString()));
     }
 }
Пример #9
0
 public IHttpActionResult UpdateUser(User usr)
 {
     try
     {
         using (var fsd = new FSDEntities())
         {
             var  insertItem = fsd.Set <User>();
             User present    = new User();
             present             = insertItem.Where(x => x.user_id == usr.user_id).First();
             present.FirstName   = usr.FirstName;
             present.Lastname    = usr.Lastname;
             present.Employee_ID = usr.Employee_ID;
             fsd.SaveChanges();
             return(Ok());
         }
     }
     catch (Exception ex)
     {
         return(BadRequest(ex.ToString()));
     }
 }
Пример #10
0
 public IHttpActionResult UpdateProject(Project proj)
 {
     try
     {
         using (var fsd = new FSDEntities())
         {
             var     insertItem = fsd.Set <Project>();
             Project present    = new Project();
             present             = insertItem.Where(x => x.Project_ID == proj.Project_ID).First();
             present.ProjectName = proj.ProjectName;
             present.StartDate   = proj.StartDate;
             present.EndDate     = proj.EndDate;
             present.priority    = proj.priority;
             fsd.SaveChanges();
             return(Ok());
         }
     }
     catch (Exception ex)
     {
         return(BadRequest(ex.ToString()));
     }
 }