| | | 1 | | using Clave.Expressionify; |
| | | 2 | | using System; |
| | | 3 | | using System.Collections.Generic; |
| | | 4 | | using System.Linq; |
| | | 5 | | using System.Text; |
| | | 6 | | using WinSolutions.Sveta.Server.Data.DataModel.Entities; |
| | | 7 | | |
| | | 8 | | namespace WinSolutions.Sveta.Server.Data.DataModel.Extensions |
| | | 9 | | { |
| | | 10 | | public static class RestExtensions |
| | | 11 | | { |
| | | 12 | | /// <summary> |
| | | 13 | | /// Возвращает актуальный остаток товара |
| | | 14 | | /// </summary> |
| | | 15 | | /// <param name="warehouseId">Id склада-владельца</param> |
| | | 16 | | [Expressionify] |
| | | 17 | | public static decimal ActualQuantity(this IEnumerable<Rest> rests, long departmentId) => |
| | 0 | 18 | | rests.Actual(departmentId) != null ? rests.Actual(departmentId).Quantity : 0; |
| | | 19 | | |
| | | 20 | | /// <summary> |
| | | 21 | | /// Возвращает актуальный остаток товара |
| | | 22 | | /// </summary> |
| | | 23 | | /// <param name="warehouseId">Id склада-владельца</param> |
| | | 24 | | [Expressionify] |
| | | 25 | | public static Rest Actual(this IEnumerable<Rest> rests, long departmentId) => |
| | 0 | 26 | | rests.FirstOrDefault(x => !x.IsDeleted && x.DepartmentId == departmentId); |
| | | 27 | | } |
| | | 28 | | } |