public IEnumerable <Employee> GetAllEmployees()
 {
     try
     {
         using (var ctx = new DevoxContext())
         {
             return(ctx.Employee.ToList());
         }
     }
     catch (Exception e)
     {
         throw e;
     }
 }
 public IEnumerable <Activity> GetAllActivities()
 {
     try
     {
         using (var ctx = new DevoxContext())
         {
             return(ctx.Activity.ToList());
         }
     }
     catch (Exception e)
     {
         throw e;
     }
 }
Example #3
0
 public IEnumerable <Project> GetAllProjects()
 {
     try
     {
         using (var ctx = new DevoxContext())
         {
             return(ctx.Project.ToList());
         }
     }
     catch (Exception e)
     {
         throw e;
     }
 }
 public void DeleteActivity(int activityID)
 {
     try
     {
         using (var ctx = new DevoxContext())
         {
             var act = ctx.Activity.FirstOrDefault(x => x.ActivityId == activityID);
             ctx.Activity.Remove(act);
         }
     }
     catch (Exception e)
     {
         throw e;
     }
 }
 public async void UpdateEmployee(Employee emp)
 {
     try
     {
         using (var ctx = new DevoxContext())
         {
             ctx.Employee.Update(emp);
             await ctx.SaveChangesAsync();
         }
     }
     catch (Exception e)
     {
         throw e;
     }
 }
 public Employee GetEmployee(int empID)
 {
     try
     {
         using (var ctx = new DevoxContext())
         {
             var emp = ctx.Employee.FirstOrDefault(x => x.EmployeeId == empID);
             return(emp);
         }
     }
     catch (Exception e)
     {
         throw e;
     }
 }
Example #7
0
 public Project GetProject(int projectID)
 {
     try
     {
         using (var ctx = new DevoxContext())
         {
             var p = ctx.Project.FirstOrDefault(x => x.ProjectId == projectID);
             return(p);
         }
     }
     catch (Exception e)
     {
         throw e;
     }
 }
 public async void UpdateActivityType(ActivityType type)
 {
     try
     {
         using (var ctx = new DevoxContext())
         {
             ctx.Update(type);
             await ctx.SaveChangesAsync();
         }
     }
     catch (Exception e)
     {
         throw e;
     }
 }
 public async void UpdateRole(Role role)
 {
     try
     {
         using (var ctx = new DevoxContext())
         {
             ctx.Role.Update(role);
             await ctx.SaveChangesAsync();
         }
     }
     catch (Exception e)
     {
         throw e;
     }
 }
 public ActivityType GetActivityType(int activityTypeID)
 {
     try
     {
         using (var ctx = new DevoxContext())
         {
             var act = ctx.ActivityType.FirstOrDefault(x => x.ActivityTypeId == activityTypeID);
             return(act);
         }
     }
     catch (Exception e)
     {
         throw e;
     }
 }
Example #11
0
 public async void UpdateProject(Project p)
 {
     try
     {
         using (var ctx = new DevoxContext())
         {
             ctx.Project.Update(p);
             await ctx.SaveChangesAsync();
         }
     }
     catch (Exception e)
     {
         throw e;
     }
 }
 public Role GetRole(int roleID)
 {
     try
     {
         using (var ctx = new DevoxContext())
         {
             var role = ctx.Role.FirstOrDefault(x => x.RoleId == roleID);
             return(role);
         }
     }
     catch (Exception e)
     {
         throw e;
     }
 }
 public async void DeleteActivityType(int activityTypeID)
 {
     try
     {
         using (var ctx = new DevoxContext())
         {
             var act = ctx.ActivityType.FirstOrDefault(x => x.ActivityTypeId == activityTypeID);
             ctx.ActivityType.Remove(act);
             await ctx.SaveChangesAsync();
         }
     }
     catch (Exception e)
     {
         throw e;
     }
 }
 public async void DeleteRole(int roleID)
 {
     try
     {
         using (var ctx = new DevoxContext())
         {
             var role = ctx.Role.FirstOrDefault(x => x.RoleId == roleID);
             ctx.Remove(role);
             await ctx.SaveChangesAsync();
         }
     }
     catch (Exception e)
     {
         throw e;
     }
 }
 public async void DeleteEmployee(int empID)
 {
     try
     {
         using (var ctx = new DevoxContext())
         {
             var emp = ctx.Employee.FirstOrDefault(x => x.EmployeeId == empID);
             ctx.Employee.Remove(emp);
             await ctx.SaveChangesAsync();
         }
     }
     catch (Exception e)
     {
         throw e;
     }
 }
Example #16
0
 public async Task DeleteProject(int projectID)
 {
     try
     {
         using (var ctx = new DevoxContext())
         {
             var p = ctx.Project.FirstOrDefault(x => x.ProjectId == projectID);
             ctx.Remove(p);
             await ctx.SaveChangesAsync();
         }
     }
     catch (Exception e)
     {
         throw e;
     }
 }
        public async Task <int> CreateEmployeeAsync(Employee emp)
        {
            try
            {
                using (var ctx = new DevoxContext())
                {
                    var r = await ctx.AddAsync(emp);

                    await ctx.SaveChangesAsync();

                    return(r.Entity.EmployeeId);
                }
            }
            catch (Exception e)
            {
                throw e;
            }
        }
        public async Task <int> CreateActivityTypeAsync(ActivityType type)
        {
            try
            {
                using (var ctx = new DevoxContext())
                {
                    var r = await ctx.ActivityType.AddAsync(type);

                    await ctx.SaveChangesAsync();

                    return(r.Entity.ActivityTypeId);
                }
            }
            catch (Exception e)
            {
                throw e;
            }
        }
        public async Task <int> CreateRoleAsync(Role role)
        {
            try
            {
                using (var ctx = new DevoxContext())
                {
                    var r = await ctx.Role.AddAsync(role);

                    return(r.Entity.RoleId);

                    await ctx.SaveChangesAsync();
                }
            }
            catch (Exception e)
            {
                throw e;
            }
        }
Example #20
0
        public async Task <int> CreateProjectAsync(Project p)
        {
            try
            {
                using (var ctx = new DevoxContext())
                {
                    var proj = await ctx.Project.AddAsync(p);

                    await ctx.SaveChangesAsync();

                    return(proj.Entity.ProjectId);
                }
            }
            catch (Exception e)
            {
                throw e;
            }
        }