public async Task <IActionResult> AddCurrency(CurrencyViewModel model) { if (ModelState.IsValid) { try { string Id = User.Claims.First(c => c.Type == "UserID").Value; var currencies = new Currencies() { Name = model.Name, Symbol = model.Symbol, Code = model.Code, CreatedBy = Id, CreatedDate = DateTime.Now }; var currencyId = await _managementService.AddCurrency(currencies); if (currencyId > 0) { return(Ok(new { status = StatusCodes.Status200OK, success = true, message = "currency" + ResponseMessages.msgCreationSuccess })); } else if (currencyId < 0) { return(Ok(new { status = StatusCodes.Status400BadRequest, success = false, message = "currency" + ResponseMessages.msgAlreadyExists })); } else { return(Ok(new { status = StatusCodes.Status404NotFound, success = false, message = ResponseMessages.msgDbConnectionError })); } } catch (Exception ex) { return(Ok(new { status = StatusCodes.Status500InternalServerError, success = false, message = ResponseMessages.msgSomethingWentWrong + ex.Message })); } } return(Ok(new { status = StatusCodes.Status406NotAcceptable, success = false, message = ResponseMessages.msgParametersNotCorrect })); }