Compare commits
4 Commits
5f345c69b9
...
053391ae44
Author | SHA1 | Date | |
---|---|---|---|
053391ae44 | |||
636a6aab7b | |||
c69226c83e | |||
6ee508645a |
15
Marco.Pms.Model/Dtos/Tenant/UpdateTenantDto.cs
Normal file
15
Marco.Pms.Model/Dtos/Tenant/UpdateTenantDto.cs
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
namespace Marco.Pms.Model.Dtos.Tenant
|
||||||
|
{
|
||||||
|
public class UpdateTenantDto
|
||||||
|
{
|
||||||
|
public string OrganizatioinName { get; set; }
|
||||||
|
public string About { get; set; }
|
||||||
|
public string Website { get; set; }
|
||||||
|
public string Name { get; set; }
|
||||||
|
public string ContactNumber { get; set; }
|
||||||
|
|
||||||
|
//public string? OragnizationSize { get; set; }
|
||||||
|
//public int IndustryId { get; set; }
|
||||||
|
public DateTime OnBoardingDate { get; set; }
|
||||||
|
}
|
||||||
|
}
|
@ -1,4 +1,4 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
@ -141,6 +141,32 @@ namespace Marco.Pms.Services.Controllers
|
|||||||
return Ok(ApiResponse<object>.SuccessResponse(tenantVM, "Tenant Profile.", 200));
|
return Ok(ApiResponse<object>.SuccessResponse(tenantVM, "Tenant Profile.", 200));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[HttpPost("edit/{tenantId}")]
|
||||||
|
public async Task<IActionResult> SuspendTenant(int tenantId, UpdateTenantDto model)
|
||||||
|
{
|
||||||
|
if (tenantId <= 0)
|
||||||
|
{
|
||||||
|
return BadRequest("Tenant Id is required and must be greater than zero.");
|
||||||
|
}
|
||||||
|
var tenant = await _context.Tenants.FirstOrDefaultAsync(t => t.Id == tenantId);
|
||||||
|
//var user = await _context.ApplicationUsers.FirstOrDefaultAsync(u => u.TenantId == tenantId && u.IsRootUser == true);
|
||||||
|
//var employee = await _context.Employees.FirstOrDefaultAsync(e => e.Id == tenantId && e.ApplicationUserId == user.Id);
|
||||||
|
if (tenant == null)
|
||||||
|
{
|
||||||
|
return NotFound("Tenant Not Found");
|
||||||
|
}
|
||||||
|
tenant.Name = model.OrganizatioinName;
|
||||||
|
tenant.DomainName = model.Website;
|
||||||
|
tenant.ContactName = model.Name;
|
||||||
|
tenant.Description = model.About;
|
||||||
|
tenant.ContactNumber = model.ContactNumber;
|
||||||
|
tenant.OnBoardingDate = model.OnBoardingDate;
|
||||||
|
|
||||||
|
await _context.SaveChangesAsync();
|
||||||
|
TenantVM tenantVM = tenant.ToTenantVMFromTenant();
|
||||||
|
return Ok(ApiResponse<object>.SuccessResponse(tenantVM, "Tenant Profile.", 200));
|
||||||
|
}
|
||||||
|
|
||||||
private static Employee CreateTenantDtoToEmployee(CreateTenantDto model, int TenantId, string? ApplicationUserId, int jobRoleId)
|
private static Employee CreateTenantDtoToEmployee(CreateTenantDto model, int TenantId, string? ApplicationUserId, int jobRoleId)
|
||||||
{
|
{
|
||||||
return new Employee
|
return new Employee
|
||||||
|
Loading…
x
Reference in New Issue
Block a user