public async Task <FundSellFeeModel> SaveFundSellFee(FundSellFeeModel fundSellFee) { FundSellFee newFundSellFee = _mapper.Map <FundSellFee>(fundSellFee); FundSellFee savedFundSellFee = await _fundSellFeeManager.SaveFundSellFee(newFundSellFee); FundSellFeeModel savedFundSellFeeModel = _mapper.Map <FundSellFeeModel>(savedFundSellFee); return(savedFundSellFeeModel); }
public async Task <IActionResult> Add(FundSellFeeViewModel fundSellFeeView) { if (!ModelState.IsValid) { return(View(fundSellFeeView)); } if (fundSellFeeView.From < 0) { ViewData["Error"] = ValidationMessages.FromInvalid; return(View(fundSellFeeView)); } if (fundSellFeeView.To < -1 || fundSellFeeView.To == 0) { ViewData["Error"] = ValidationMessages.ToInvalid; return(View(fundSellFeeView)); } var model = new FundSellFeeModel() { FundId = fundSellFeeView.FundId, FromLabel = fundSellFeeView.FromLabel, ToLabel = fundSellFeeView.ToLabel, Fee = fundSellFeeView.Fee }; if (fundSellFeeView.DateFromLabel == DateLabel.Month) { model.From = fundSellFeeView.From * 30; } else if (fundSellFeeView.DateFromLabel == DateLabel.Year) { model.From = fundSellFeeView.From * 365; } else { model.From = fundSellFeeView.From; } if (fundSellFeeView.To == -1) { model.To = -1; } else { if (fundSellFeeView.DateToLabel == DateLabel.Month) { model.To = fundSellFeeView.To * 30; } else if (fundSellFeeView.DateToLabel == DateLabel.Year) { model.To = fundSellFeeView.To * 365; } else { model.To = fundSellFeeView.To; } } await _fundSellFeeService.SaveFundSellFee(model); return(RedirectToAction(nameof(SettingsCMSController.Index), "SettingsCMS")); }
public async Task UpdateFundSellFee(FundSellFeeModel fundSellFee) { FundSellFee newFundSellFee = _mapper.Map <FundSellFee>(fundSellFee); await _fundSellFeeManager.UpdateFundSellFee(newFundSellFee); }