Ejemplo n.º 1
0
        public ActionResult CreateEntity(PerformanceInfo model)
        {
            if (!ModelState.IsValid)
            {
                return(Json(
                           new OperateResult
                {
                    content = Model.Utility.GetModelStateErrors(ModelState),
                },
                           JsonRequestBehavior.AllowGet
                           ));
            }

            OperateResult or = PerformanceManager.Add(model);

            return(Json(or, JsonRequestBehavior.AllowGet));
        }
Ejemplo n.º 2
0
        public bool PerformanceAddStub()
        {
            for (var i = 0; i < PerformanceStubSize; i++)
            {
                PerformanceInfo e = new PerformanceInfo();

                e.code = "P-" + i;
                e.performanceRewards = 2000 + i * 500;
                OperateResult or = PerformanceManager.Add(e);
                if (or.status == OperateStatus.Error)
                {
                    StackTrace st  = new StackTrace(new StackFrame(true));
                    string     msg = $"App Trace >>> in file: {st.GetFrame(0).GetFileName()} " +
                                     $"line {st.GetFrame(0).GetFileLineNumber()} message: {or.content}";
                    Trace.WriteLine(msg);
                    return(false);
                }
            }

            return(true);
        }