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

            OperateResult or = BenefitManager.Add(model);

            return(Json(or, JsonRequestBehavior.AllowGet));
        }
Exemplo n.º 2
0
        public bool BenefitAddStub()
        {
            for (var i = 0; i < BenefitStubSize; i++)
            {
                BenefitInfo e = new BenefitInfo();

                e.code           = "B-" + i;
                e.benefitRewards = 2000 + i * 500;

                OperateResult or = BenefitManager.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);
        }