//List of Policies in a certain Policy category
 public List<Policy> ReturnListOfPoliciesInCategory(PolicyCategory category)
 {
     return _repo.GetPoliciesListInCategory(category);
 }
Exemple #2
0
 public Policy()
 {
     Category = new PolicyCategory();
 }
        public List<PolicyCategory> GetPolicyCategories()
        {
            using (SqlConnection cn = new SqlConnection(Settings.ConnectionString))
            {
                var cmd = new SqlCommand();
                cmd.CommandText = "select * from [Categories]";
                cmd.Connection = cn;
                cn.Open();

                using (SqlDataReader dr = cmd.ExecuteReader())
                {
                    while (dr.Read())
                    {
                        var newCategory = new PolicyCategory();
                        newCategory.CategoryId = int.Parse(dr["CategoryID"].ToString());
                        newCategory.CategoryTitle = dr["CategoryTitle"].ToString();

                        ListOfPolicyCategories.Add(newCategory);
                    }
                }
            }

            return ListOfPolicyCategories.OrderBy(c => c.CategoryTitle).ToList();
        }
 public List<Policy> GetPoliciesListInCategory(PolicyCategory category)
 {
     return ListOfPolicies.Select(p => p).Where(p => p.Category.CategoryTitle == category.CategoryTitle).ToList();
 }
 public void AddNewPolicyInNewCategory(Policy newPolicy)
 {
     ListOfPolicies.Add(newPolicy);
     PolicyCategory newCategory = new PolicyCategory()
     {
         CategoryTitle = newPolicy.Category.CategoryTitle
     };
     ListOfPolicyCategories.Add(newCategory);
 }
 public List<Policy> GetPoliciesListInCategory(PolicyCategory category)
 {
     throw new NotImplementedException();
 }