public void Create(WorkSpaceTypeView workSpaceTypeView, long structure, IEnumerable<string> services) { if (workSpaceTypeView == null) throw new ArgumentNullException("workSpaceTypeView"); if (services == null) throw new ArgumentNullException("services"); var structureObj = StructureManager.Get(_dbContext, structure); if (structureObj == null) throw new ArgumentException("\"structure\" is a invalid argument"); var workSpaceType = workSpaceTypeView.Convert(); workSpaceType.Structure = structureObj; foreach (var service in services) { var serviceObj = ServiceManager.Get(_dbContext, service); if (serviceObj == null) throw new ArgumentException(String.Format("The service {0} is a invalid argument", service)); //TO DO CONTAINS workSpaceType.Services.Add(serviceObj); } _dbContext.WorkSpaceTypes.Add(workSpaceType); _dbContext.SaveChanges(); }
public void Create(WorkSpaceTypeView workSpaceTypeView, long structure) { if (workSpaceTypeView == null) throw new ArgumentNullException("workSpaceTypeView"); var structureObj = StructureManager.Get(_dbContext, structure); if (structureObj == null) throw new ArgumentException("\"structure\" is a invalid argument"); var workSpaceType = workSpaceTypeView.Convert(); workSpaceType.Structure = structureObj; _dbContext.WorkSpaceTypes.Add(workSpaceType); _dbContext.SaveChanges(); }