Ejemplo n.º 1
0
        public void UpdateProject(SPAProjectManager.Entities.Projects project)
        {
            SPAProjectManagerEntities mockContext = MockDataSetList();
            var projectBL = new ProjectBL(mockContext);

            projectBL.UpdateProject(project);
        }
Ejemplo n.º 2
0
        public void UpdateProject(SPAProjectManager.Entities.Projects project)
        {
            var proj    = _projectManager.Projects.Where(x => x.Project_ID == project.ProjectID).FirstOrDefault();
            var user    = _projectManager.Users.Where(x => x.User_ID == project.ManagerID).FirstOrDefault();
            var extUser = _projectManager.Users.Where(x => x.Project_ID == project.ProjectID).FirstOrDefault();

            if (proj != null && user != null)
            {
                proj.Project1   = project.Project;
                proj.Start_Date = project.StartDate ?? DateTime.Now;
                proj.End_Date   = project.EndDate ?? DateTime.Now;
                proj.Priority   = project.Priority;
                if (extUser != null)
                {
                    extUser.Project_ID = null;
                }
                user.Project_ID = project.ProjectID;
                _projectManager.SaveChanges();
            }
        }
Ejemplo n.º 3
0
        public void AddProject(SPAProjectManager.Entities.Projects project)
        {
            Project proj = new Project
            {
                // Project_ID=project.ProjectID,
                Project1   = project.Project,
                Start_Date = project.StartDate ?? DateTime.Now,
                End_Date   = project.EndDate ?? DateTime.Now,
                Priority   = project.Priority
            };

            _projectManager.Projects.Add(proj);
            _projectManager.SaveChanges();
            var proId = proj.Project_ID;
            var ur    = _projectManager.Users.Where(x => x.User_ID == project.ManagerID).FirstOrDefault();

            if (ur != null)
            {
                ur.Project_ID = proId;
                _projectManager.SaveChanges();
            }
        }
Ejemplo n.º 4
0
        public IHttpActionResult AddProject([FromBody] SPAProjectManager.Models.Projects project)
        {
            try
            {
                SPAProjectManager.Entities.Projects proj = new SPAProjectManager.Entities.Projects
                {
                    // ProjectID=project.ProjectID,
                    Project   = project.Project,
                    StartDate = project.StartDate,
                    EndDate   = project.EndDate,
                    Priority  = project.Priority,
                    ManagerID = project.ManagerID
                };

                _projectBL.AddProject(proj);
                return(Ok());
            }
            catch (Exception ex)
            {
                return(InternalServerError());
            }
        }