public async void UpdateActivityType(ActivityType type)
 {
     try
     {
         using (var ctx = new DevoxContext())
         {
             ctx.Update(type);
             await ctx.SaveChangesAsync();
         }
     }
     catch (Exception e)
     {
         throw e;
     }
 }
Beispiel #2
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 async void UpdateRole(Role role)
 {
     try
     {
         using (var ctx = new DevoxContext())
         {
             ctx.Role.Update(role);
             await ctx.SaveChangesAsync();
         }
     }
     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 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;
     }
 }
Beispiel #7
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 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;
     }
 }
        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;
            }
        }
Beispiel #11
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;
            }
        }
        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;
            }
        }