public async Task <int> AddEditLoyalityGlobalSettings(LoyalityGlobalSettingViewModel model) { try { var settingsInfo = await FindAsync(new { id = model.id }); if (settingsInfo == null) { settingsInfo = new OrgLoyalityGlobalSettings(); settingsInfo.createdDate = DateTime.Now; } settingsInfo.bitePayRatio = model.bitePayRatio; settingsInfo.dcbFlexRatio = model.dcbFlexRatio; settingsInfo.globalRatePoints = model.globalRatePoints; settingsInfo.globalReward = model.globalReward; settingsInfo.modifiedDate = DateTime.Now; settingsInfo.organisationId = model.organisationId; settingsInfo.userStatusRegularRatio = model.userStatusRegularRatio; settingsInfo.userStatusVipRatio = model.userStatusVipRatio; settingsInfo.loyalityThreshhold = model.loyalityThreshhold; settingsInfo.FirstTransactionBonus = model.FirstTransactionBonus; var Id = await InsertOrUpdateAsync(settingsInfo, new { id = model.id > 0 ? model.id : 0 }); return(Id); } catch (Exception) { throw; } }
public async Task <IActionResult> AddUpdateOrgLoyalityGlobalSettings(LoyalityGlobalSettingViewModel model) { try { var Id = await _loyalityGlobalSetting.AddEditLoyalityGlobalSettings(model); if (Id <= 0) { return(Ok(new ApiResponse(Microsoft.AspNetCore.Http.StatusCodes.Status200OK, false, MessagesConstants.LoyalityGlobalSuccessfulSetting, "0"))); } return(Ok(new ApiResponse(Microsoft.AspNetCore.Http.StatusCodes.Status200OK, true, MessagesConstants.LoyalityGlobalSuccessfulSetting, Id))); } catch (Exception ex) { HttpContext.RiseError(new Exception(string.Concat("API := (Loyality := AddEditLoyalityGlobalSettings)", ex.Message, " Stack Trace : ", ex.StackTrace, " Inner Exception : ", ex.InnerException))); return(Ok(someIssueInProcessing)); } }