本文整理汇总了C#中System.Guid.IsNullOrEmpty方法的典型用法代码示例。如果您正苦于以下问题:C# Guid.IsNullOrEmpty方法的具体用法?C# Guid.IsNullOrEmpty怎么用?C# Guid.IsNullOrEmpty使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Guid
的用法示例。
在下文中一共展示了Guid.IsNullOrEmpty方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetClassRoom
/// <summary>
/// Get a class room by its id
/// </summary>
/// <param name="classRoomId">Id of the class room</param>
/// <returns></returns>
public async Task<ClassRoom> GetClassRoom(Guid classRoomId)
{
if (classRoomId.IsNullOrEmpty())
throw new ArgumentNullException(nameof(classRoomId));
return await _classRoomRepo.GetById(classRoomId);
}
示例2: UpdateClassRoom
/// <summary>
/// Update a class room
/// </summary>
/// <param name="classRoomId">Id of the class room</param>
/// <param name="editClassRoom">Updated details of the class room</param>
/// <returns></returns>
public async Task<ClassRoom> UpdateClassRoom(Guid classRoomId, EditClassRoom editClassRoom)
{
if (classRoomId.IsNullOrEmpty())
throw new ArgumentNullException(nameof(classRoomId));
if (editClassRoom == null)
throw new ArgumentNullException(nameof(editClassRoom));
return await _classRoomRepo.Update(classRoomId, editClassRoom);
}
示例3: DeleteClassRoom
/// <summary>
/// Delete a class room
/// </summary>
/// <param name="classRoomId">Id of the class room</param>
/// <returns></returns>
public async Task<int> DeleteClassRoom(Guid classRoomId)
{
if (classRoomId.IsNullOrEmpty())
throw new ArgumentNullException(nameof(classRoomId));
return await _classRoomRepo.Delete(classRoomId);
}