Exemplo n.º 1
0
        public Project ShowProjectByID(int id, bool visible)
        {
            Project proj = projects.FirstOrDefault(a => a.ID == id);

            proj.Products = projProds.GetProjectProducts(id);
            proj.Notes    = notes.GetNotesByProject(id, true);


            return(proj);
        }
Exemplo n.º 2
0
        public Project ShowProjectByID(int id, bool visible)
        {
            Project p = new Project();

            try
            {
                p          = context.Project.FirstOrDefault(a => a.ID == id);
                p.Notes    = notes.GetNotesByProject(id, visible);
                p.Products = projProd.GetProjectProducts(id);
                p.TotalDue = p.Products.Sum(a => a.Price);
            }
            catch { }

            return(p);
        }
Exemplo n.º 3
0
 public void GetProjectProductsTest()
 {
     Assert.Empty(repo.GetProjectProducts(1));
     repo.AddProjectProduct(1, p1, 2);
     Assert.Single(repo.GetProjectProducts(1));
     repo.AddProjectProduct(1, p2, 1);
     Assert.Equal(2, repo.GetProjectProducts(1).Count);
 }