public IAjaxResult AddStorageRegion(StorageRegion storageRegion) { if (_storageRegionService.Add(storageRegion)) { return(Success("添加成功")); } else { return(Error("添加失败")); } }
public bool AddNewRegion(GetRegionDto getRegionDto) { if (_regionService.Find(c => c.Name == getRegionDto.RegionName) == null) { if (_regionService.Add(getRegionDto.RegionName) != 0) { return(false); } } Region region = _regionService.Find(c => c.Name == getRegionDto.RegionName); StorageRegion storageRegion = new StorageRegion() { RegionId = region.Id, StorageId = getRegionDto.StorageId, Capacity = getRegionDto.RegionCapacity }; return(_storageRegionService.Add(storageRegion)); }