public ResponseList <AssetDto> GetAssetsByAssignedId(long assignedId) { ResponseList <AssetDto> response = new ResponseList <AssetDto>(); AssetContext assetContext = new AssetContext(); response.Items = assetContext.GetAssets().ToList(); return(response); }
public ResponseList <AssetDto> Get([FromUri] SearchRequest <AssetCriteriaDto> request) { ResponseList <AssetDto> response = new ResponseList <AssetDto>(); if (request == null) { // Configure the Error response. response.Code = OperationCode.ResponseCode.ERROR; response.ErrorList.Add(MessageResource.GetInstance().GetText("SawDAL_GetListNull", MESSAGE_RESOURCE)); } else { int?count = null; if (request.CountTotal) { count = 0; } AssetContext assetContext = new AssetContext(); var assets = assetContext.GetAssets(request.Criteria, request.Page, request.Take, ref count); if (assets.Any()) { response.Items = assets.ToList(); response.TotalItems = response.Items.Count; response.Count = request.CountTotal ? count.Value : 0; response.Code = OperationCode.ResponseCode.SUCCESS; response.MessageList.Add(MessageResource.GetInstance().GetText("SawDAL_GetListSuccess", MESSAGE_RESOURCE)); } else { response.Code = OperationCode.ResponseCode.SUCCESS; response.MessageList.Add(MessageResource.GetInstance().GetText("SawDAL_GetListEmpty", MESSAGE_RESOURCE)); } } return(response); }