pramod_Task#474 #88

Open
pramod.mahajan wants to merge 7 commits from pramod_Task#474 into Issue_Jun_1W_2
Showing only changes of commit 4d69413e29 - Show all commits

View File

@ -671,6 +671,26 @@ namespace Marco.Pms.Services.Controllers
//-------------------Document-------------------------------------
[HttpGet("documents")]
public async Task<IActionResult> GetDocumentMaster()
{
try
{
Guid tenantId = _userHelper.GetTenantId();
var documentMast = await _context.DocumentMasters
.Where(d => d.TenantId == tenantId)
.ToListAsync();
return Ok(ApiResponse<object>.SuccessResponse(documentMast, "Document List", 200));
}
catch (Exception ex)
{
return StatusCode(500, ApiResponse<object>.ErrorResponse("An error occurred", ex.Message, 500));
}
}
[HttpPost("document")]
public async Task<IActionResult> CreateDocument([FromBody] DocumentMasterDto documentMaster)
@ -713,7 +733,7 @@ namespace Marco.Pms.Services.Controllers
await _context.DocumentMasters.AddAsync(newDocument);
await _context.SaveChangesAsync();
return Ok(ApiResponse<string>.SuccessResponse("Document created successfully", "Success", 200));
return Ok(ApiResponse<object>.SuccessResponse(newDocument,"Document created successfully", 200));
}
catch (Exception ex)
{
@ -764,7 +784,19 @@ namespace Marco.Pms.Services.Controllers
_context.DocumentMasters.Update(existingDocument);
await _context.SaveChangesAsync();
return Ok(ApiResponse<string>.SuccessResponse("Document updated successfully", "Success", 200));
var updatedDto = new DocumentMaster
{
Id = existingDocument.Id,
Name = existingDocument.Name,
Type = existingDocument.Type,
Description = existingDocument.Description,
ValidationException = existingDocument.ValidationException,
IsRequired = existingDocument.IsRequired
// Add other fields as needed
};
return Ok(ApiResponse<object>.SuccessResponse(updatedDto,"Document updated successfully", 200));
}
catch (Exception ex)
{