/// <summary> /// From Area Pivot To Area Dto. /// </summary> /// <param name="areaPivot">area pivot to assemble.</param> /// <returns>AreaDto result.</returns> public static AreaDto ToDto(this AreaPivot areaPivot) { if (areaPivot == null) { return(null); } return(new AreaDto { AreaId = areaPivot.AreaId, }); }
/// <summary> /// From AreaPivot to Area. /// </summary> /// <param name="areaPivot">areaPivot to assemble.</param> /// <returns>Area result.</returns> public static Area ToEntity(this AreaPivot areaPivot) { if (areaPivot == null) { return(null); } return(new Area { AreaId = areaPivot.AreaId, }); }
/// <summary> /// Search Area by id. /// </summary> /// <param name="request">The Area Request Pivot to retrive.</param> /// <returns>Area Response Pivot response.</returns> public AreaResponsePivot FindAreas(AreaRequestPivot request) { if (request?.AreaPivot == null) { throw new ArgumentNullException(nameof(request)); } List <AreaPivot> results = new List <AreaPivot>(); AreaPivot result = new AreaPivot(); switch (request.FindAreaPivot) { case FindAreaPivot.AreaId: result = _unitOfWork.AreaRepository.GetById(request.AreaPivot.AreaId)?.ToPivot(); break; } return(new AreaResponsePivot { AreaPivotList = results, AreaPivot = result }); }