예제 #1
0
        public bool Create(TaskP task)
        {
            TeamUpContext dbTask = new TeamUpContext();

            dbTask.Tasks.Add(task);
            dbTask.SaveChanges();
            return(true);
        }
예제 #2
0
        public void Update(TaskP task)
        {
            TeamUpContext dbTask = new TeamUpContext();
            var           taskDB = dbTask.Tasks.FirstOrDefault(x => x.TaskID == task.TaskID);

            taskDB.Name        = task.Name;
            taskDB.DateClose   = task.DateClose;
            taskDB.Description = task.Description;
            dbTask.SaveChanges();
        }
예제 #3
0
        public bool Edit(TaskModel tkM)
        {
            Mapping mapping = new Mapping();

            TaskP taskE = new TaskP();

            mapping.MapObjects(tkM, taskE);
            taskRepository.Update(taskE);


            return(true);
        }
예제 #4
0
        public bool Create(TaskModel taskM)
        {
            TaskP entity = new TaskP();

            Mapping mapping       = new Mapping();
            Account createAccount = new Account();
            Project orginProject  = new Project();


            mapping.MapObjects(taskM, entity);

            entity.ProjectID = taskM.Project;
            entity.UserName  = taskM.AccountCreator;

            return(taskRepository.Create(entity));
        }
예제 #5
0
        public TaskModel GetOne(int id)
        {
            TaskModel taskM   = new TaskModel();
            Mapping   mapping = new Mapping();

            TaskP taskDb = taskRepository.GetOne(id);

            if (taskDb != null)
            {
                mapping.MapObjects(taskDb, taskM);
            }

            taskM.AccountCreator = taskDb.UserName;
            taskM.Project        = taskDb.ProjectID;

            return(taskM);
        }
예제 #6
0
        public bool CloseOrOpen(int Id, bool CloseOrOpen)
        {
            TeamUpContext dbTask = new TeamUpContext();
            TaskP         task   = new TaskP();

            task = dbTask.Tasks.FirstOrDefault(x => x.TaskID == Id);


            if (task != null)
            {
                task.isClosed = CloseOrOpen;
                dbTask.SaveChanges();
                return(true);
            }
            else
            {
                return(false);
            }
        }