Exemple #1
0
 public VersionFeature(VersionFeatureEditModel data)
 {
     this.AppId        = data.AppId;
     this.Version      = data.Version;
     this.FeatureAppId = data.FeatureAppId;
     this.Content      = data.Content;
 }
Exemple #2
0
        public async Task <ActionResult> VersionFeatureAppsEdit(VersionFeatureEditModel model)
        {
            using (var db = new TDContext())
            {
                if (!ModelState.IsValid)
                {
                    return(Json(Js.Error(this.GetModelStateError())));
                }
                var FeatureAppId = model.Selected;

                var find = db.FeatureApps.Find(FeatureAppId);
                if (find == null)
                {
                    find = db.FeatureApps.FirstOrDefault(x => x.Name == model.Selected);
                    if (find == null)
                    {
                        find = new FeatureApp
                        {
                            Name = model.Selected
                        };
                        db.FeatureApps.Add(find);
                        var str = await db.SaveDatabase();

                        if (str != null)
                        {
                            return(Json(str.GetError()));
                        }
                    }
                    FeatureAppId = find.Id;
                }
                model.FeatureAppId = FeatureAppId;
                var data = await db.VersionFeatureApps.FindAsync(model.AppId, model.Version, FeatureAppId);

                if (data == null)
                {
                    data = new VersionFeature(model);
                    db.VersionFeatureApps.Add(data);
                    var str = await db.SaveDatabase();

                    if (str != null)
                    {
                        return(Json(str.GetError()));
                    }
                }
                data.Content         = model.Content;
                db.Entry(data).State = EntityState.Modified;
                var result = await db.SaveDatabase();

                if (result.NotNull())
                {
                    result.GetError();
                }
                return(Json(Js.SuccessRedirect(TD.Global.VersionFeatureAppChanged, string.Format("{0}/VersionsEdit?AppId={1}&Version={2}", TD.Properties.Resources.AdminAppEditLink, model.AppId, model.Version))));
            }
        }
Exemple #3
0
        public ActionResult VersionFeatureAppsEdit(string AppId, LicenseType?Version, string FeatureAppId)
        {
            if (Version == null || string.IsNullOrEmpty(AppId) || string.IsNullOrEmpty(FeatureAppId))
            {
                return(View());
            }
            var app = db.VersionFeatureApps.Find(AppId, Version.Value, FeatureAppId);

            if (app == null)
            {
                return(View());
            }
            var model = new VersionFeatureEditModel(app)
            {
                Selected = FeatureAppId.ToString(),

                FeatureApps = GetAllFeatureApp()
            };

            return(View(model));
        }
Exemple #4
0
        public ActionResult VersionFeatureAppsAdd(string AppId, LicenseType?Version)
        {
            if (string.IsNullOrEmpty(AppId) || Version == null)
            {
                return(View());
            }

            var app = db.Apps.Find(AppId);

            if (app == null)
            {
                return(View());
            }
            var model = new VersionFeatureEditModel()
            {
                AppId       = app.Id,
                AppName     = app.Name,
                Version     = Version.Value,
                FeatureApps = GetAllFeatureApp(app, false, Version)
            };

            return(View(model));
        }