...
This commit is contained in:
@@ -3,6 +3,7 @@ using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Shared.DTOs.Serch;
|
||||
using Shared.DTOs;
|
||||
using System.Xml.Linq;
|
||||
|
||||
namespace Back.Controllers
|
||||
{
|
||||
@@ -25,8 +26,11 @@ namespace Back.Controllers
|
||||
var user = await _servUser.GetUserByUserID(Convert.ToInt32(UserID));
|
||||
// if (!await _checkPermission.AllowSYSGetCOD(Convert.ToInt32(UserID), user.RolUsers.First().CompanyID)) return Forbid("شما دسترسی به خواندن اطلاعات کالا را نداربد");
|
||||
return Ok(await _servCOD.GetCODs(user.RolUsers.First().CompanyID, itemSerch));
|
||||
|
||||
|
||||
}
|
||||
[HttpGet("GetUnits")]
|
||||
public async Task<ActionResult<IdName<int>>> GetUnits()
|
||||
{
|
||||
return Ok(await _servCOD.GetUnits());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -1,6 +1,7 @@
|
||||
using Back.Common;
|
||||
using Back.Data.Contracts;
|
||||
using Back.Data.Models;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Shared.DTOs;
|
||||
using Shared.DTOs.Serch;
|
||||
|
||||
@@ -9,9 +10,12 @@ namespace Back.Services
|
||||
public class ServCOD
|
||||
{
|
||||
private readonly IAsyncRepository<CODItem> _CODRepo;
|
||||
public ServCOD(IAsyncRepository<CODItem> CODRepo)
|
||||
private readonly IAsyncRepository<CODUnit> _UnitRepo;
|
||||
public ServCOD(IAsyncRepository<CODItem> CODRepo, IAsyncRepository<CODUnit> unitRepo)
|
||||
{
|
||||
_CODRepo = CODRepo;
|
||||
_UnitRepo = unitRepo;
|
||||
|
||||
}
|
||||
public async Task<PagingDto<RCOD>?> GetCODs(int CompanyID, ItemSerchGetCOD itemSerch)
|
||||
{
|
||||
@@ -47,5 +51,9 @@ namespace Back.Services
|
||||
})
|
||||
.Paging(itemSerch.PageIndex, itemSerch.PageSize);
|
||||
}
|
||||
public async Task<List<IdName<int>>> GetUnits()
|
||||
{
|
||||
return await _UnitRepo.GetAll().Select(s => new IdName<int> { ID = s.ID, Title = s.Title }).ToListAsync();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
14
Shared/DTOs/IdName.cs
Normal file
14
Shared/DTOs/IdName.cs
Normal file
@@ -0,0 +1,14 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Shared.DTOs
|
||||
{
|
||||
public class IdName<T>
|
||||
{
|
||||
public T ID { get; set; }
|
||||
public string Title { get; set; }
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user