Example #1
0
        public bool DelTask(IdDTO iddto, Guid id)
        {
            TasksRepository repository = new TasksRepository();

            var taskId = iddto.Id;

            var tasks = repository.GetItem(taskId);

            if (tasks != null)
            {
                repository.Delete(taskId);

                var tasks2 = repository.GetItem(taskId);

                if (tasks2 == null)
                {
                    return(true);
                }
                else
                {
                    return(false);
                }
            }
            else
            {
                return(false);
            }
        }
Example #2
0
        public bool AddTask(Tasks task, Guid id)
        {
            if (task.Name == null || task.Date == null || id == null)
            {
                return(false);
            }
            else
            {
                TasksRepository repository = new TasksRepository();

                //Gerar novo ID
                task.Id      = Guid.NewGuid();
                task.UsersId = id;
                repository.Add(task);


                var tasks = repository.GetItem(task.Id);

                if (tasks != null)
                {
                    return(true);
                }
                else
                {
                    return(false);
                }
            }
        }
Example #3
0
        public Boolean UpdateTasks(Guid id, Tasks item)
        {
            UsersRepository repository = new UsersRepository();

            var user = repository.GetItem(id);

            if (user != null)
            {
                TasksRepository taskrepository = new TasksRepository();

                var task = taskrepository.GetItem(item.Id);

                if (task != null)
                {
                    if (task.UsersId == id)
                    {
                        task.Name = item.Name;
                        task.Date = item.Date;
                        taskrepository.Update(id, task);
                        return(true);
                    }
                    else
                    {
                        return(false);
                    }
                }
                else
                {
                    return(false);
                }
            }
            else
            {
                return(false);
            }
        }