62,046
社区成员
发帖
与我相关
我的任务
分享
public class ModelSetConfig
{
public double TriggerThresholdMark { set; get; }
public decimal ProfitLimitation { set; get; }
public decimal LossLimitation { set; get; }
public List<ModelEntity> ModelList { set; get; }
public ModelSetConfig()
{
ModelList = new List<ModelEntity>();
}
}
public class ModelEntity
{
public string ModelName { set; get; }
public bool? IsMainBuy { set; get; }
}
@model BackTestWeb.Models.ModelSetConfig
@using (Html.BeginForm())
{
<div class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title">@ViewBag.Title</h3>
</div>
<div class="panel-body container">
<div class="row">
@Html.LabelFor(model => model.TriggerThresholdMark, new { @class = "control-label col-md-1" })
<div class="col-md-2">
@Html.EditorFor(model => model.TriggerThresholdMark)
@Html.ValidationMessageFor(model => model.TriggerThresholdMark)
</div>
@Html.LabelFor(model => model.ProfitLimitation, new { @class = "control-label col-md-1" })
<div class="col-md-2">
@Html.EditorFor(model => model.ProfitLimitation)
@Html.ValidationMessageFor(model => model.ProfitLimitation)
</div>
@Html.LabelFor(model => model.LossLimitation, new { @class = "control-label col-md-1" })
<div class="col-md-2">
@Html.EditorFor(model => model.LossLimitation)
@Html.ValidationMessageFor(model => model.LossLimitation)
</div>
</div>
</div>
@foreach(var modelEnity in @Model.ModelList)
{
@Html.Action("Index", "ModelConfig",modelEnity)
}
<div class="form-group">
<div class="col-md-offset-2 col-md-10">
<input type="submit" value="添加辅助模型" class="btn btn-default" />
</div>
</div>
</div>
}
public class ModelSetConfigController : Controller
{
//
// GET: /StrategyManage/ModelSetConfig/
public ActionResult Index()
{
ViewBag.Title = "全局参数";
var modelConfig = new ModelSetConfig();
return PartialView("_ModelSetConfig", CreateInitModelSetConfig());
}
[HttpPost]
public ActionResult Index(ModelSetConfig modelSetConfig)
{
modelSetConfig.ModelList.Add(new ModelEntity());
return PartialView("_ModelSetConfig", modelSetConfig);
}
}