Beispiel #1
0
        protected virtual void Save()
        {
            AreaEntity info = FillEntity();
            var        rev  = Ioc.Resolve <IApplicationService, AreaEntity>().Save(info);

            if (rev)
            {
                if (info.SaveType == SaveType.Add)
                {
                    var id = info.Id;
                    info.Publish();
                    info.Id = id;
                    info.Import();
                    info.Properties = null;
                    info.SetProperty(it => it.Origin);
                    info.SaveType = SaveType.Modify;
                    Ioc.Resolve <IApplicationService, AreaEntity>().Save(info);
                }
                Response.Write("{Code:\"true\",Message:\"" + info.Id + "\"}");
            }
            else if (info.Errors != null && info.Errors.Count > 0)
            {
                Response.Write("{Code:\"false\",Message:\"" + info.Errors[0].Message + "\"}");
            }
            else
            {
                Response.Write("{Code:\"false\",Message:\"保存失败\"}");
            }
        }