public ActionResult SaveOrUpdateUserTradingConfiguration(UserTradingConfiguration utc) { UserTradingConfiguration result = null; bool overlap = false; if (utc.DateFrom > utc.DateTill) { throw new Exception("Date Till can not be before Date From"); } //check for timeframe correctness try { this.ExecuteInDBTransaction((dl) => { overlap = dl.UserDL.UserTradingConfigurationOverlap(utc); }); if (overlap) { throw new Exception("This user has overlapping methodics"); } this.ExecuteInDBTransaction((dl) => { result = dl.UserDL.SaveOrUpdateUserTradingConfiguration(utc); this.Logger.InfoFormat("User {0} saved user trading configuration. UserEntity={1}", this.CurrentUserName, JsonSerializer.Serialize(utc)); }); if (result != null) { return(new JsonNetResult() { Data = result, JsonRequestBehavior = System.Web.Mvc.JsonRequestBehavior.AllowGet }); } return(new JsonNetResult() { Data = 0, JsonRequestBehavior = System.Web.Mvc.JsonRequestBehavior.AllowGet }); } catch (Exception e) { return(new JsonNetResult() { Data = e.Message, JsonRequestBehavior = System.Web.Mvc.JsonRequestBehavior.AllowGet }); } }
public ActionResult SaveOrUpdateUserTradingConfiguration(UserTradingConfiguration utc) { UserTradingConfiguration result = null; bool overlap = false; if (utc.DateFrom > utc.DateTill) { throw new Exception("Date Till can not be before Date From"); } //check for timeframe correctness try { this.ExecuteInDBTransaction((dl) => { overlap = dl.UserDL.UserTradingConfigurationOverlap(utc); }); if (overlap) { throw new Exception("This user has overlapping methodics"); } this.ExecuteInDBTransaction((dl) => { result = dl.UserDL.SaveOrUpdateUserTradingConfiguration(utc); this.Logger.InfoFormat("User {0} saved user trading configuration. UserEntity={1}", this.CurrentUserName, JsonSerializer.Serialize(utc)); }); if (result != null) { return new JsonNetResult() { Data = result, JsonRequestBehavior = System.Web.Mvc.JsonRequestBehavior.AllowGet }; } return new JsonNetResult() { Data = 0, JsonRequestBehavior = System.Web.Mvc.JsonRequestBehavior.AllowGet }; } catch (Exception e) { return new JsonNetResult() { Data = e.Message, JsonRequestBehavior = System.Web.Mvc.JsonRequestBehavior.AllowGet }; } }