Esempio n. 1
0
 public int InsertUserDetails(MODEL.User user)
 {
     using (dbContext)
     {
         dbContext.Users.Add(new DAC.User()
         {
             Last_Name   = user.LastName,
             First_Name  = user.FirstName,
             Employee_ID = user.EmployeeId
         });
         return(dbContext.SaveChanges());
     }
 }
Esempio n. 2
0
        public int InsertTaskDetails(Task task)
        {
            using (dbContext)
            {
                if (task.Priority == 0)
                {
                    dbContext.ParentTasks.Add(new DAC.ParentTask()
                    {
                        Parent_Task_Name = task.Task_Name
                    });
                }
                else
                {
                    DAC.Task taskDetail = new DAC.Task()
                    {
                        Task_Name  = task.Task_Name,
                        Project_ID = task.Project_ID,
                        Start_Date = task.Start_Date,
                        End_Date   = task.End_Date,
                        Parent_ID  = task.Parent_ID,
                        Priority   = task.Priority,
                        Status     = task.Status
                    };
                    dbContext.Tasks.Add(taskDetail);
                    dbContext.SaveChanges();

                    var editDetails = (from editUser in dbContext.Users
                                       where editUser.User_ID.ToString().Contains(task.User.UserId.ToString())
                                       select editUser).First();
                    // Modify existing records
                    if (editDetails != null)
                    {
                        editDetails.Task_ID = taskDetail.Task_ID;
                    }
                }
                return(dbContext.SaveChanges());
            }
        }
Esempio n. 3
0
 public int InsertProjectDetails(MODEL.Project project)
 {
     using (dbContext)
     {
         DAC.Project proj = new DAC.Project()
         {
             Project_Name = project.ProjectName,
             Start_Date   = project.ProjectStartDate,
             End_Date     = project.ProjectEndDate,
             Priority     = project.Priority
         };
         dbContext.Projects.Add(proj);
         dbContext.SaveChanges();
         var editDetails = (from editUser in dbContext.Users
                            where editUser.User_ID.ToString().Contains(project.User.UserId.ToString())
                            select editUser).First();
         // Modify existing records
         if (editDetails != null)
         {
             editDetails.Project_ID = proj.Project_ID;
         }
         return(dbContext.SaveChanges());
     }
 }