public ActionResult Add() { ViewBag.Title = Resources.PageTitle.Level1_Add; ViewBag.PageBar = GetPageBar(Resources.PageTitle.Level1_Add); ViewBag.Description = ""; var model = new Level1ViewModel(); model.Published = true; return View(model); }
public MainWindowViewModel() { var client = DependencyInjection.Container.Resolve <IClient>(); LimitOrderViewModel = new NewLimitOrderViewModel(client); ActiveOrdersViewModel = new ActiveOrdersViewModel(client); ExecutionsViewModel = new ClientExecutionsViewModel(client); L1ViewModel = new Level1ViewModel(client); MarketOrderViewModel = new NewMarketOrderViewModel(client); StopLimitOrdersViewModel = new ActiveStopLimitOrdersViewModel(client); }
public JsonResult Add(Level1ViewModel model) { if (ModelState.IsValid) { if (model.IsDefault) { _level1Service.UpdateDefaultFalse(); } var EntityMapped = Mapper.Map<Level1>(model); _level1Service.Add(EntityMapped); return Json(new { data = model, success = true }, JsonRequestBehavior.AllowGet); } var errors = ModelState.GetDistinctModelErrors(); return Json(new { data = model, success = false, ErrorsList = errors }, JsonRequestBehavior.AllowGet); }
public JsonResult Edit(Level1ViewModel model) { if (ModelState.IsValid) { if (model.IsDefault) { _level1Service.UpdateDefaultFalse(); } var Level1Entity = _level1Service.GetById(model.Id); Level1Entity = Mapper.Map(model, Level1Entity); _level1Service.Edit(Level1Entity); return Json(new { data = model, success = true }, JsonRequestBehavior.AllowGet); } var errors = ModelState.GetDistinctModelErrors(); return Json(new { data = model, success = false, ErrorsList = errors }, JsonRequestBehavior.AllowGet); }