ulr
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
using Back.Common;
|
||||
using Back.Data.Contracts;
|
||||
using Back.Data.Models;
|
||||
using Back.Services;
|
||||
using Back.Validations;
|
||||
@@ -23,11 +24,14 @@ namespace Back.Controllers
|
||||
private readonly ServValidatinMsg _servValidatinMsg;
|
||||
private readonly servSendMsg _servSendMsg;
|
||||
private readonly CompanyRegistrationValidation _companyRegistrationValidation;
|
||||
private readonly IAsyncRepository<Ulr> _ulrRepo;
|
||||
public BaseController(ServBase sBase, MobileValidation mobilevalidation
|
||||
, servCompany servCompany, servUser servUser
|
||||
, servPermission servPermission, ServValidatinMsg servValidatinMsg
|
||||
, servSendMsg servSendMsg, CompanyRegistrationValidation companyRegistrationValidation)
|
||||
, servSendMsg servSendMsg, CompanyRegistrationValidation companyRegistrationValidation
|
||||
, IAsyncRepository<Ulr> ulrRepo)
|
||||
{
|
||||
_ulrRepo = ulrRepo;
|
||||
_sBase = sBase;
|
||||
_mobilevalidation = mobilevalidation;
|
||||
_servCompany = servCompany;
|
||||
@@ -186,5 +190,21 @@ namespace Back.Controllers
|
||||
_servSendMsg.toContinue(modelvc.Code.ToString(),Item.Username, "فراموشی کلمه عبور");
|
||||
return Ok(modelvc.ID);
|
||||
}
|
||||
[HttpPost("Ulr")]
|
||||
[AllowAnonymous]
|
||||
public async Task<ActionResult> Ulr(UlrDto Item)
|
||||
{
|
||||
if (Item.Type=="Panel" || Item.Type == "Main")
|
||||
{
|
||||
await _ulrRepo.AddBoolResultAsync(new Data.Models.Ulr
|
||||
{
|
||||
Type = Item.Type,
|
||||
Date=DateTime.Now.ConvertMiladiToShamsi(),
|
||||
Time=DateTime.Now.Hour.ToString("00")+ DateTime.Now.Minute.ToString("00"),
|
||||
Ip= HttpContext.Connection.RemoteIpAddress?.ToString()
|
||||
});
|
||||
}
|
||||
return Ok();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -45,6 +45,7 @@ namespace TaxPayer.Infrastructure.Persistence
|
||||
public DbSet<SaleLead> SaleLeads { get; set; }
|
||||
public DbSet<UserNotfi> UserNotifis { get; set; }
|
||||
public DbSet<stuff> Stuffs { get; set; }
|
||||
public DbSet<Ulr> Ulrs { get; set; }
|
||||
#endregion
|
||||
//public override Task<int> SaveChangesAsync(CancellationToken cancellationToken = new CancellationToken())
|
||||
//{
|
||||
|
12
Back/Data/Models/Ulr.cs
Normal file
12
Back/Data/Models/Ulr.cs
Normal file
@@ -0,0 +1,12 @@
|
||||
namespace Back.Data.Models
|
||||
{
|
||||
//User login report
|
||||
public class Ulr
|
||||
{
|
||||
public int ID { get; set; }
|
||||
public string Ip { get; set; }
|
||||
public string Type { get; set; } //Panel or Main
|
||||
public string Date { get; set; }
|
||||
public string Time { get; set; }
|
||||
}
|
||||
}
|
@@ -85,7 +85,7 @@ builder.Services.AddCors(options =>
|
||||
options.AddPolicy(origins,
|
||||
policy =>
|
||||
{
|
||||
policy.WithOrigins("https://localhost:7224", "http://localhost:5107")
|
||||
policy.WithOrigins("https://localhost:7224", "http://localhost:5107", "http://195.88.208.142")
|
||||
.AllowAnyHeader()
|
||||
.WithHeaders(HeaderNames.ContentType)
|
||||
.AllowAnyMethod();
|
||||
|
Reference in New Issue
Block a user