This commit is contained in:
mmrbnjd
2024-06-14 22:37:22 +03:30
parent 39c9de8f4c
commit 376da0e7d0
10 changed files with 3815 additions and 13 deletions

View File

@@ -1,4 +1,5 @@
using Back.Common;
using Back.Data.Models;
using Back.Services;
using Back.Validations;
using Microsoft.AspNetCore.Authorization;
@@ -36,6 +37,32 @@ namespace Back.Controllers
return Ok(await _servCus.GetCustomers(user.RolUsers.First().CompanyID, itemSerch));
}
[HttpGet("GetCustomer/{ID}")]
public async Task<ActionResult<RCustomer>> GetCustomer(int ID)
{
var claim = HttpContext.User.Claims.First(c => c.Type == "UserID");
var UserID = claim.Value;
var user = await _servUser.GetUserByUserID(Convert.ToInt32(UserID));
var cus = await _servCus.GetCustomerByCustomerID(ID, user.RolUsers.First().CompanyID);
return Ok(new RCustomer
{
Address = cus.Address,
BranchID = cus.BranchID,
CustomerType = cus.CustomerType,
CustomerTypeTitle = cus.CustomerType.GetEnumDisplayName(),
EconomicCode = cus.EconomicCode,
Email = cus.Email,
FullName = cus.FullName,
ID = ID,
Info = cus.Info,
MeliCode = cus.MeliCode,
PassportNumber = cus.PassportNumber,
Phone = cus.Phone,
ZipCode = cus.ZipCode
});
}
[HttpGet("GetAllForidName")]
public async Task<ActionResult<List<ForCustomerSearch>>> GetAllForSearch()