public async Task <ActionResult <DisbursementsAndClaimsMasterDTO> > GetDisbursementsAndClaimsMaster(int id) { DisbursementsAndClaimsMasterDTO disbursementsAndClaimsMasterDTO = new DisbursementsAndClaimsMasterDTO(); var disbursementsAndClaimsMaster = await _context.DisbursementsAndClaimsMasters.FindAsync(id); if (disbursementsAndClaimsMaster == null) { return(NotFound()); } disbursementsAndClaimsMasterDTO.Id = disbursementsAndClaimsMaster.Id; disbursementsAndClaimsMasterDTO.EmployeeId = disbursementsAndClaimsMaster.EmployeeId; disbursementsAndClaimsMasterDTO.PettyCashRequestId = disbursementsAndClaimsMaster.PettyCashRequestId; disbursementsAndClaimsMasterDTO.ExpenseReimburseReqId = disbursementsAndClaimsMaster.ExpenseReimburseReqId; disbursementsAndClaimsMasterDTO.AdvanceOrReimburseId = disbursementsAndClaimsMaster.AdvanceOrReimburseId; disbursementsAndClaimsMasterDTO.ProjectId = disbursementsAndClaimsMaster.ProjectId; disbursementsAndClaimsMasterDTO.SubProjectId = disbursementsAndClaimsMaster.SubProjectId; disbursementsAndClaimsMasterDTO.WorkTaskId = disbursementsAndClaimsMaster.WorkTaskId; disbursementsAndClaimsMasterDTO.RecordDate = disbursementsAndClaimsMaster.RecordDate; disbursementsAndClaimsMasterDTO.Amount = disbursementsAndClaimsMaster.Amount; disbursementsAndClaimsMasterDTO.CostCentreId = disbursementsAndClaimsMaster.CostCentreId; disbursementsAndClaimsMasterDTO.ApprovalStatusId = disbursementsAndClaimsMaster.ApprovalStatusId; return(disbursementsAndClaimsMasterDTO); }
public async Task <ActionResult <IEnumerable <DisbursementsAndClaimsMasterDTO> > > GetDisbursementsAndClaimsMasters() { List <DisbursementsAndClaimsMasterDTO> ListDisbursementsAndClaimsMasterDTO = new List <DisbursementsAndClaimsMasterDTO>(); var disbursementsAndClaimsMasters = await _context.DisbursementsAndClaimsMasters.ToListAsync(); foreach (DisbursementsAndClaimsMaster disbursementsAndClaimsMaster in disbursementsAndClaimsMasters) { DisbursementsAndClaimsMasterDTO disbursementsAndClaimsMasterDTO = new DisbursementsAndClaimsMasterDTO(); disbursementsAndClaimsMasterDTO.Id = disbursementsAndClaimsMaster.Id; disbursementsAndClaimsMasterDTO.EmployeeId = disbursementsAndClaimsMaster.EmployeeId; disbursementsAndClaimsMasterDTO.PettyCashRequestId = disbursementsAndClaimsMaster.PettyCashRequestId; disbursementsAndClaimsMasterDTO.ExpenseReimburseReqId = disbursementsAndClaimsMaster.ExpenseReimburseReqId; disbursementsAndClaimsMasterDTO.AdvanceOrReimburseId = disbursementsAndClaimsMaster.AdvanceOrReimburseId; disbursementsAndClaimsMasterDTO.ProjectId = disbursementsAndClaimsMaster.ProjectId; disbursementsAndClaimsMasterDTO.SubProjectId = disbursementsAndClaimsMaster.SubProjectId; disbursementsAndClaimsMasterDTO.WorkTaskId = disbursementsAndClaimsMaster.WorkTaskId; disbursementsAndClaimsMasterDTO.RecordDate = disbursementsAndClaimsMaster.RecordDate; disbursementsAndClaimsMasterDTO.Amount = disbursementsAndClaimsMaster.Amount; disbursementsAndClaimsMasterDTO.CostCentreId = disbursementsAndClaimsMaster.CostCentreId; disbursementsAndClaimsMasterDTO.ApprovalStatusId = disbursementsAndClaimsMaster.ApprovalStatusId; ListDisbursementsAndClaimsMasterDTO.Add(disbursementsAndClaimsMasterDTO); } return(ListDisbursementsAndClaimsMasterDTO); }
public async Task <IActionResult> PutDisbursementsAndClaimsMaster(int id, DisbursementsAndClaimsMasterDTO disbursementsAndClaimsMasterDto) { if (id != disbursementsAndClaimsMasterDto.Id) { return(Conflict(new RespStatus { Status = "Failure", Message = "Id state is invalid" })); } var disbursementsAndClaimsMaster = await _context.DisbursementsAndClaimsMasters.FindAsync(id); disbursementsAndClaimsMaster.EmployeeId = disbursementsAndClaimsMasterDto.EmployeeId; disbursementsAndClaimsMaster.PettyCashRequestId = disbursementsAndClaimsMasterDto.PettyCashRequestId; disbursementsAndClaimsMaster.ExpenseReimburseReqId = disbursementsAndClaimsMasterDto.ExpenseReimburseReqId; disbursementsAndClaimsMaster.RequestTypeId = disbursementsAndClaimsMasterDto.RequestTypeId; disbursementsAndClaimsMaster.ProjectId = disbursementsAndClaimsMasterDto.ProjectId; disbursementsAndClaimsMaster.SubProjectId = disbursementsAndClaimsMasterDto.SubProjectId; disbursementsAndClaimsMaster.WorkTaskId = disbursementsAndClaimsMasterDto.WorkTaskId; disbursementsAndClaimsMaster.RecordDate = disbursementsAndClaimsMasterDto.RecordDate; disbursementsAndClaimsMaster.AmountToWallet = disbursementsAndClaimsMasterDto.AmountToWallet; disbursementsAndClaimsMaster.AmountToCredit = disbursementsAndClaimsMasterDto.AmountToCredit; disbursementsAndClaimsMaster.IsSettledAmountCredited = disbursementsAndClaimsMasterDto.IsSettledAmountCredited; disbursementsAndClaimsMaster.SettledDate = disbursementsAndClaimsMasterDto.SettledDate; disbursementsAndClaimsMaster.SettlementComment = disbursementsAndClaimsMasterDto.SettlementComment; disbursementsAndClaimsMaster.SettlementAccount = disbursementsAndClaimsMasterDto.SettlementAccount; disbursementsAndClaimsMaster.SettlementBankCard = disbursementsAndClaimsMasterDto.SettlementBankCard; disbursementsAndClaimsMaster.AdditionalData = disbursementsAndClaimsMasterDto.AdditionalData; disbursementsAndClaimsMaster.CostCenterId = disbursementsAndClaimsMasterDto.CostCenterId; disbursementsAndClaimsMaster.ApprovalStatusId = disbursementsAndClaimsMasterDto.ApprovalStatusId; _context.DisbursementsAndClaimsMasters.Update(disbursementsAndClaimsMaster); //_context.Entry(disbursementsAndClaimsMasterDTO).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { throw; } return(Ok(new RespStatus { Status = "Success", Message = "Disburse Details Updated!" })); }
public async Task <IActionResult> PutDisbursementsAndClaimsMaster(int id, DisbursementsAndClaimsMasterDTO disbursementsAndClaimsMasterDto) { if (id != disbursementsAndClaimsMasterDto.Id) { return(BadRequest()); } var disbursementsAndClaimsMaster = await _context.DisbursementsAndClaimsMasters.FindAsync(id); disbursementsAndClaimsMaster.Id = disbursementsAndClaimsMasterDto.Id; disbursementsAndClaimsMaster.Id = disbursementsAndClaimsMasterDto.Id; disbursementsAndClaimsMaster.EmployeeId = disbursementsAndClaimsMasterDto.EmployeeId; disbursementsAndClaimsMaster.PettyCashRequestId = disbursementsAndClaimsMasterDto.PettyCashRequestId; disbursementsAndClaimsMaster.ExpenseReimburseReqId = disbursementsAndClaimsMasterDto.ExpenseReimburseReqId; disbursementsAndClaimsMaster.AdvanceOrReimburseId = disbursementsAndClaimsMasterDto.AdvanceOrReimburseId; disbursementsAndClaimsMaster.ProjectId = disbursementsAndClaimsMasterDto.ProjectId; disbursementsAndClaimsMaster.SubProjectId = disbursementsAndClaimsMasterDto.SubProjectId; disbursementsAndClaimsMaster.WorkTaskId = disbursementsAndClaimsMasterDto.WorkTaskId; disbursementsAndClaimsMaster.RecordDate = disbursementsAndClaimsMasterDto.RecordDate; disbursementsAndClaimsMaster.Amount = disbursementsAndClaimsMasterDto.Amount; disbursementsAndClaimsMaster.CostCentreId = disbursementsAndClaimsMasterDto.CostCentreId; disbursementsAndClaimsMaster.ApprovalStatusId = disbursementsAndClaimsMasterDto.ApprovalStatusId; _context.DisbursementsAndClaimsMasters.Update(disbursementsAndClaimsMaster); //_context.Entry(disbursementsAndClaimsMasterDTO).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!DisbursementsAndClaimsMasterExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <ActionResult <DisbursementsAndClaimsMasterDTO> > GetDisbursementsAndClaimsMaster(int id) { var disbursementsAndClaimsMaster = await _context.DisbursementsAndClaimsMasters.FindAsync(id); if (disbursementsAndClaimsMaster == null) { return(Conflict(new RespStatus { Status = "Failure", Message = "Disburese Id invalid!" })); } DisbursementsAndClaimsMasterDTO disbursementsAndClaimsMasterDTO = new DisbursementsAndClaimsMasterDTO { Id = disbursementsAndClaimsMaster.Id, EmployeeId = disbursementsAndClaimsMaster.EmployeeId, PettyCashRequestId = disbursementsAndClaimsMaster.PettyCashRequestId, ExpenseReimburseReqId = disbursementsAndClaimsMaster.ExpenseReimburseReqId, RequestTypeId = disbursementsAndClaimsMaster.RequestTypeId, ProjectId = disbursementsAndClaimsMaster.ProjectId, SubProjectId = disbursementsAndClaimsMaster.SubProjectId, WorkTaskId = disbursementsAndClaimsMaster.WorkTaskId, RecordDate = disbursementsAndClaimsMaster.RecordDate, ClaimAmount = disbursementsAndClaimsMaster.ClaimAmount, AmountToWallet = disbursementsAndClaimsMaster.AmountToWallet, AmountToCredit = disbursementsAndClaimsMaster.AmountToCredit, IsSettledAmountCredited = (disbursementsAndClaimsMaster.IsSettledAmountCredited ?? false) ? true : false, SettledDate = disbursementsAndClaimsMaster.SettledDate, SettlementComment = disbursementsAndClaimsMaster.SettlementComment, SettlementAccount = disbursementsAndClaimsMaster.SettlementAccount, SettlementBankCard = disbursementsAndClaimsMaster.SettlementBankCard, AdditionalData = disbursementsAndClaimsMaster.AdditionalData, CostCenterId = disbursementsAndClaimsMaster.CostCenterId, ApprovalStatusId = disbursementsAndClaimsMaster.ApprovalStatusId }; return(disbursementsAndClaimsMasterDTO); }
public async Task <ActionResult <IEnumerable <DisbursementsAndClaimsMasterDTO> > > GetDisbursementsAndClaimsMasters() { List <DisbursementsAndClaimsMasterDTO> ListDisbursementsAndClaimsMasterDTO = new List <DisbursementsAndClaimsMasterDTO>(); var disbursementsAndClaimsMasters = await _context.DisbursementsAndClaimsMasters.ToListAsync(); foreach (DisbursementsAndClaimsMaster disbursementsAndClaimsMaster in disbursementsAndClaimsMasters) { DisbursementsAndClaimsMasterDTO disbursementsAndClaimsMasterDTO = new DisbursementsAndClaimsMasterDTO { Id = disbursementsAndClaimsMaster.Id, EmployeeId = disbursementsAndClaimsMaster.EmployeeId, PettyCashRequestId = disbursementsAndClaimsMaster.PettyCashRequestId, ExpenseReimburseReqId = disbursementsAndClaimsMaster.ExpenseReimburseReqId, RequestTypeId = disbursementsAndClaimsMaster.RequestTypeId, ProjectId = disbursementsAndClaimsMaster.ProjectId, SubProjectId = disbursementsAndClaimsMaster.SubProjectId, WorkTaskId = disbursementsAndClaimsMaster.WorkTaskId, RecordDate = disbursementsAndClaimsMaster.RecordDate, ClaimAmount = disbursementsAndClaimsMaster.ClaimAmount, AmountToWallet = disbursementsAndClaimsMaster.AmountToWallet, AmountToCredit = disbursementsAndClaimsMaster.AmountToCredit, IsSettledAmountCredited = (disbursementsAndClaimsMaster.IsSettledAmountCredited ?? false) ? true :false, SettledDate = disbursementsAndClaimsMaster.SettledDate, SettlementComment = disbursementsAndClaimsMaster.SettlementComment, SettlementAccount = disbursementsAndClaimsMaster.SettlementAccount, SettlementBankCard = disbursementsAndClaimsMaster.SettlementBankCard, AdditionalData = disbursementsAndClaimsMaster.AdditionalData, CostCenterId = disbursementsAndClaimsMaster.CostCenterId, ApprovalStatusId = disbursementsAndClaimsMaster.ApprovalStatusId }; ListDisbursementsAndClaimsMasterDTO.Add(disbursementsAndClaimsMasterDTO); } return(ListDisbursementsAndClaimsMasterDTO); }
public async Task <ActionResult <DisbursementsAndClaimsMaster> > PostDisbursementsAndClaimsMaster(DisbursementsAndClaimsMasterDTO disbursementsAndClaimsMasterDto) { DisbursementsAndClaimsMaster disbursementsAndClaimsMaster = new DisbursementsAndClaimsMaster(); disbursementsAndClaimsMaster.EmployeeId = disbursementsAndClaimsMasterDto.EmployeeId; disbursementsAndClaimsMaster.PettyCashRequestId = disbursementsAndClaimsMasterDto.PettyCashRequestId; disbursementsAndClaimsMaster.ExpenseReimburseReqId = disbursementsAndClaimsMasterDto.ExpenseReimburseReqId; disbursementsAndClaimsMaster.AdvanceOrReimburseId = disbursementsAndClaimsMasterDto.AdvanceOrReimburseId; disbursementsAndClaimsMaster.ProjectId = disbursementsAndClaimsMasterDto.ProjectId; disbursementsAndClaimsMaster.SubProjectId = disbursementsAndClaimsMasterDto.SubProjectId; disbursementsAndClaimsMaster.WorkTaskId = disbursementsAndClaimsMasterDto.WorkTaskId; disbursementsAndClaimsMaster.RecordDate = disbursementsAndClaimsMasterDto.RecordDate; disbursementsAndClaimsMaster.Amount = disbursementsAndClaimsMasterDto.Amount; disbursementsAndClaimsMaster.CostCentreId = disbursementsAndClaimsMasterDto.CostCentreId; disbursementsAndClaimsMaster.ApprovalStatusId = disbursementsAndClaimsMasterDto.ApprovalStatusId; _context.DisbursementsAndClaimsMasters.Add(disbursementsAndClaimsMaster); await _context.SaveChangesAsync(); return(CreatedAtAction("GetDisbursementsAndClaimsMaster", new { id = disbursementsAndClaimsMaster.Id }, disbursementsAndClaimsMaster)); }