Free cookie consent management tool by TermsFeed Policy Generator

Changeset 8144


Ignore:
Timestamp:
06/28/12 09:46:23 (12 years ago)
Author:
jkarder
Message:

#1648: fixed DeleteUserGroup service method

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Services.Access/3.3/AccessService.cs

    r8040 r8144  
    744744      var g = group; //linq does not like vars called group
    745745
    746       using (DA.AccessServiceDataContext context = new DA.AccessServiceDataContext()) {
    747         var query = from ug in context.UserGroupBases.OfType<DA.UserGroup>()
    748                     where ug.Id == g.Id
    749                     select ug;
    750         if (query.Count() > 0) {
    751           context.UserGroupBases.DeleteOnSubmit(query.First());
    752           context.SubmitChanges();
    753         } else {
    754           throw new Exception("UserGroup with id " + g.Id + " does not exist.");
     746      if (g.Id != null && g.Id != Guid.Empty) {
     747        using (DA.AccessServiceDataContext context = new DA.AccessServiceDataContext()) {
     748          var query = from ug in context.UserGroupBases.OfType<DA.UserGroup>()
     749                      where ug.Id == g.Id
     750                      select ug;
     751          if (query.Count() > 0) {
     752            context.UserGroupBases.DeleteOnSubmit(query.First());
     753            context.SubmitChanges();
     754          } else {
     755            throw new Exception("UserGroup with id " + g.Id + " does not exist.");
     756          }
    755757        }
    756758      }
Note: See TracChangeset for help on using the changeset viewer.