public async Task UpdateTransactionAsync(TransactionMD entity, TransactionMDDto transDto) { entity.TransactionId = transDto.TransactionId; entity.Status = GetEnumStatusName(transDto.Status); entity.Type = GetEnumTypeName(transDto.Type); entity.ClientName = transDto.ClientName; entity.Amount = transDto.Amount; await _context.SaveChangesAsync(); }
public async Task <ActionResult> UpdateTransactionAsync([FromForm] TransactionMDDto transDto) { int transId = int.Parse(HttpContext.Request.RouteValues["transactionId"].ToString()); TransactionMD trans = await _transactionService.GetTransactionByIdAsync(transId); if (trans == null) { return(NotFound(new ApiResponse(404))); } await _transactionService.UpdateTransactionAsync(trans, transDto); return(Ok(new ApiResponse(200, "Resource updated successfully"))); }