...
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
using AutoMapper;
|
||||
using Common.Dtos;
|
||||
using Common.Dtos.Company;
|
||||
using Common.Dtos.Exper;
|
||||
using Hushian.Application.Contracts.Persistence;
|
||||
using Hushian.Application.Models;
|
||||
using Hushian.Application.Validation;
|
||||
@@ -99,6 +101,41 @@ namespace Hushian.Application.Services
|
||||
company.allowBot = @checked;
|
||||
return await _CompanyRepository.UPDATEBool(company);
|
||||
}
|
||||
public async Task<ResponseBase<bool>> ChangePasswordCompany(ChangePasswordDto model, int CompanyID)
|
||||
{
|
||||
ResponseBase<bool> Response = new();
|
||||
|
||||
var company = await _CompanyRepository.Get().FirstOrDefaultAsync(f => f.ID == CompanyID);
|
||||
if (string.IsNullOrEmpty(model.OldPassWord) || model.OldPassWord.GetHash()!=company.Password)
|
||||
{
|
||||
Response.Errors.Add("کلمه عبور فعلی صحیح نمی باشد");
|
||||
}
|
||||
else
|
||||
{
|
||||
company.Password = model.NewPassWord.GetHash();
|
||||
Response.Value= await _CompanyRepository.UPDATEBool(company);
|
||||
if (!Response.Value) Response.Errors.Add("خطا در ذخیره سازی");
|
||||
else Response.Success = true;
|
||||
}
|
||||
return Response;
|
||||
}
|
||||
public async Task<ResponseBase<int>> ForgetPasswordCompany(string Mobile)
|
||||
{
|
||||
ResponseBase<int> Response = new();
|
||||
|
||||
var company = await _CompanyRepository.Get().FirstOrDefaultAsync(f => f.Mobile == Mobile);
|
||||
if (company==null)
|
||||
{
|
||||
Response.Errors.Add("کاربری یافت نشد");
|
||||
}
|
||||
else
|
||||
{
|
||||
Response.Value= await _VerificationService.GenerateCodeByForgetPassword(Mobile);
|
||||
Response.Success = true;
|
||||
|
||||
}
|
||||
return Response;
|
||||
}
|
||||
private async Task<ResponseBase<bool>> NewCompany(RegisterCompanyDto dto)
|
||||
{
|
||||
ResponseBase<bool> Response = new();
|
||||
|
Reference in New Issue
Block a user