| | | 1 | | using System.Collections.Generic; |
| | | 2 | | using System.Linq; |
| | | 3 | | using System.Threading.Tasks; |
| | | 4 | | using Microsoft.EntityFrameworkCore; |
| | | 5 | | using Microsoft.Extensions.Logging; |
| | | 6 | | using WinSolutions.Sveta.Common; |
| | | 7 | | using WinSolutions.Sveta.Server.Data.DataModel.Contexts; |
| | | 8 | | using WinSolutions.Sveta.Server.Data.DataModel.Entities; |
| | | 9 | | using WinSolutions.Sveta.Server.Services.Interfaces; |
| | | 10 | | |
| | | 11 | | namespace WinSolutions.Sveta.Server.Services.Implements |
| | | 12 | | { |
| | | 13 | | public class MovementRouteActionsService : SvetaServiceBase, IMovementRouteActionsService |
| | | 14 | | { |
| | | 15 | | private readonly ILogger<MovementRouteActionsService> _logger; |
| | | 16 | | private readonly SvetaDbContext _db; |
| | | 17 | | public MovementRouteActionsService(IAuthenticationService authenticationService, |
| | | 18 | | ILogger<MovementRouteActionsService> logger, |
| | | 19 | | SvetaDbContext db |
| | 114 | 20 | | ) : base(authenticationService) |
| | 114 | 21 | | { |
| | 114 | 22 | | _logger = logger; |
| | 114 | 23 | | _db = db; |
| | 114 | 24 | | } |
| | | 25 | | |
| | | 26 | | /// <summary> |
| | | 27 | | /// Возвращает список доступных действий для документа |
| | | 28 | | /// </summary> |
| | | 29 | | /// <param name="movementStatusId"></param> |
| | | 30 | | /// <returns></returns> |
| | 1 | 31 | | public async Task<List<MovementRouteAction>> GetActions(long movementStatusId) => await _db.MovementRouteActions |
| | 1 | 32 | | .Where(d => !d.IsDeleted && d.StatusId == movementStatusId).ToListAsync(); |
| | | 33 | | |
| | | 34 | | public async Task<List<MovementRouteAction>> GetActions() => |
| | 115 | 35 | | await _db.MovementRouteActions.Where(d => !d.IsDeleted).ToListAsync(); |
| | | 36 | | } |
| | | 37 | | } |