Esempio n. 1
0
 /// <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,
     });
 }
Esempio n. 2
0
 /// <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,
     });
 }
Esempio n. 3
0
        /// <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
            });
        }