Exemplo n.º 1
0
        public async Task <GoalCategory> UpdateGoalCategory(GoalCategory category)
        {
            _context.GoalCategories.Update(category);
            await _context.SaveChangesAsync();

            return(category);
        }
Exemplo n.º 2
0
 /// <summary>
 /// Constructor for a goal, takes in a name, description, category and estimated hours.
 /// </summary>
 /// <param name="name">Name of goal</param>
 /// <param name="desc">Description of goal</param>
 /// <param name="cate">Category of goal</param>
 /// <param name="estHours">Estimated hours to completion</param>
 public Goal(string name, string desc, GoalCategory cate, int estHours)
     : base(name, desc)
 {
     _category = cate;
     _estHours = estHours;
     _completed = false;
 }
Exemplo n.º 3
0
        public async Task <GoalCategory> UpdateGoalCategory(GoalCategory category)
        {
            GoalCategory categoryToUpdate = await GetGoalCategoryById(category.Id);

            categoryToUpdate.Name  = category.Name;
            categoryToUpdate.Goals = category.Goals;
            return(await _aboutRepository.UpdateGoalCategory(categoryToUpdate));
        }
Exemplo n.º 4
0
        public async Task <GoalCategory> AddGoalCategory(GoalCategory category)
        {
            await _context.GoalCategories.AddAsync(category);

            await _context.SaveChangesAsync();

            return(category);
        }
Exemplo n.º 5
0
        public async Task <GoalCategory> DeleteGoalCategoryById(Guid id)
        {
            GoalCategory categoryToDelete = await GetGoalCategoryById(id);

            _context.GoalCategories.Remove(categoryToDelete);
            await _context.SaveChangesAsync();

            return(categoryToDelete);
        }
Exemplo n.º 6
0
 public async Task <GoalCategory> AddGoalCategory(GoalCategory category)
 {
     return(await _aboutRepository.AddGoalCategory(category));
 }
Exemplo n.º 7
0
 /// <summary>
 /// A constructor for a short term goal. Sets values and takes in a name, description, category and a list of required tasks. Also takes in an int for estimated hours.
 /// </summary>
 /// <param name="name">String</param>
 /// <param name="desc">String</param>
 /// <param name="category">GoalCategory</param>
 /// <param name="reqTasks">List of required Task Goals</param>
 /// <param name="estTime">Integer</param>
 public ShortTermGoal(string name, string desc, GoalCategory category, List<TaskGoal> reqTasks, int estTime)
     : base(name, desc, category, estTime)
 {
     _reqTasks = reqTasks;
     ExpVal = 100;
 }
Exemplo n.º 8
0
 /// <summary>
 /// Returns a string list of the goals based on the input category
 /// </summary>
 /// <param name="cat"></param>
 /// <returns></returns>
 public string ListCategory(GoalCategory cat)
 {
     return _user.ListCategory(cat);
 }
Exemplo n.º 9
0
 /// <summary>
 /// A constructor for long term goal that also takes in an estimated hours for the completion of the goal
 /// </summary>
 /// <param name="name">String</param>
 /// <param name="desc">String </param>
 /// <param name="category">GoalCategory</param>
 /// <param name="reqShort">List of Short term Goals</param>
 /// <param name="estHours">Int</param>
 public LongTermGoal(string name, string desc, GoalCategory category, List<ShortTermGoal> reqShort, int estHours)
     : base(name, desc, category, estHours)
 {
     _reqShort = reqShort;
     ExpVal = 1000;
 }
Exemplo n.º 10
0
        /// <summary>
        /// Returns a string list of goals based on the inputed category
        /// </summary>
        /// <param name="cat">GoalCategory</param>
        /// <returns>String</returns>
        public string ListCategory(GoalCategory cat)
        {
            string result = "";
            switch (cat)
            {
                case GoalCategory.Career:
                    foreach (Goal g in CareerGoals)
                    {
                        result += g.List();
                    }
                    break;

                case GoalCategory.Health:
                    foreach (Goal g in HealthGoals)
                    {
                        result += g.List();
                    }
                    break;

                case GoalCategory.Hobby:
                    foreach (Goal g in HobbyGoals)
                    {
                        result += g.List();
                    }
                    break;

                default:
                    foreach (Goal g in InterGoals)
                    {
                        result += g.List();
                    }
                    break;
            }
            return result;
        }
Exemplo n.º 11
0
        public async Task <List <Goal> > GetGoalsByCategoryId(Guid id)
        {
            GoalCategory category = await GetGoalCategoryById(id);

            return(await _context.Goals.Where(x => x.Category == category).ToListAsync());
        }