Esempio n. 1
0
        public DeleteRoleGroupResponse Delete(int id)
        {
            var response = new DeleteRoleGroupResponse();
            try
            {
                var roleGroup = new Data.Entities.RoleGroup { Id = id };
                DataContext.RoleGroups.Attach(roleGroup);
                DataContext.Entry(roleGroup).State = EntityState.Deleted;
                DataContext.SaveChanges();
                response.IsSuccess = true;
                response.Message = "User RoleGroup item has been deleted successfully";
            }
            catch (DbUpdateException dbUpdateException)
            {
                response.Message = dbUpdateException.Message;
            }

            return response;
        }
Esempio n. 2
0
        public DeleteRoleGroupResponse Delete(int id)
        {
            var response = new DeleteRoleGroupResponse();

            try
            {
                var roleGroup = new Data.Entities.RoleGroup {
                    Id = id
                };
                DataContext.RoleGroups.Attach(roleGroup);
                DataContext.Entry(roleGroup).State = EntityState.Deleted;
                DataContext.SaveChanges();
                response.IsSuccess = true;
                response.Message   = "User RoleGroup item has been deleted successfully";
            }
            catch (DbUpdateException dbUpdateException)
            {
                response.Message = dbUpdateException.Message;
            }

            return(response);
        }