Exemplo n.º 1
0
        public BLLProject Insert(BLLProject entity)
        {
            DALProject dalProject = GetDALProject(entity);

            _db.AddToProjects(dalProject);
            _db.SaveChanges();
            entity.Id = dalProject.ID;
            return(entity);
        }
Exemplo n.º 2
0
        public BLLProject Get(int id)
        {
            DALProject dalProject = GetDALProject(id);

            if (dalProject == null)
            {
                return(null);
            }
            return(GetBLLProject(dalProject));
        }
Exemplo n.º 3
0
        public BLLProject Get(string projectName)
        {
            DALProject dalProject = _db.Projects.Where(p => p.Name == projectName).SingleOrDefault();

            if (dalProject == null)
            {
                return(null);
            }
            return(GetBLLProject(dalProject));
        }
Exemplo n.º 4
0
 internal static BLLProject GetBLLProject(DALProject dalProject)
 {
     return(new BLLProject
     {
         Id = dalProject.ID,
         Name = dalProject.Name,
         Description = dalProject.Description,
         IsActive = dalProject.IsActive,
         CreateDate = dalProject.CreateDate
     });
 }
Exemplo n.º 5
0
        public BLLProject Delete(int id)
        {
            DALProject dalProject = GetDALProject(id);

            if (dalProject == null)
            {
                return(null);
            }
            _db.DeleteObject(dalProject);
            _db.SaveChanges();
            return(GetBLLProject(dalProject));
        }
Exemplo n.º 6
0
        public bool Update(BLLProject entity)
        {
            DALProject dalProject = GetDALProject(entity.Name);

            if (dalProject == null)
            {
                return(false);
            }
            dalProject.Description = entity.Description;
            dalProject.IsActive    = entity.IsActive;
            dalProject.CreateDate  = entity.CreateDate;
            return(_db.SaveChanges() > 0);
        }
Exemplo n.º 7
0
 internal static BLLProject GetBLLProject(DALProject dalProject)
 {
     return new BLLProject
     {
         Id = dalProject.ID,
         Name = dalProject.Name,
         Description = dalProject.Description,
         IsActive = dalProject.IsActive,
         CreateDate = dalProject.CreateDate
     };
 }