Esempio n. 1
0
        public static ModelPostModel ConvertModelToModelPostModel(this object input)
        {
            var model = new ModelPostModel();

            ConvertToIPost(input, model);
            return(model);
        }
Esempio n. 2
0
        public ActionResult Edit(ModelPostModel model)
        {
            var key = ModelManager.GetMapperKey(model.FullType);

            try
            {
                ModelManager.Update(model);
            }
            catch { }
            if (!String.IsNullOrEmpty(model.PostReturnUrl))
            {
                return(Redirect(model.PostReturnUrl));
            }
            return(RedirectToAction("Index", "ModelManagement", new { @area = G.AdminPath, @id = key }));
        }
Esempio n. 3
0
        public ActionResult Create(ModelPostModel model)
        {
            ModelManager.Create(model);
            var key = ModelManager.GetMapperKey(model.FullType);

            if (!String.IsNullOrEmpty(model.PostReturnUrl))
            {
                return(Redirect(model.PostReturnUrl));
            }
            if (String.IsNullOrEmpty(key))
            {
                return(RedirectToAction("Index", "DashBoard", new { @area = G.AdminPath, @id = key }));
            }
            return(RedirectToAction("Index", "ModelManagement", new { @area = G.AdminPath, @id = key }));
        }
Esempio n. 4
0
 public Task CreateOrUpdate(ModelPostModel model)
 {
     return(Task.Run(() =>
     {
         try
         {
             if (model.Id <= 0)
             {
                 Create(model);
             }
             else
             {
                 Update(model);
             }
         }
         catch { }
     }));
 }
Esempio n. 5
0
        public static void Update(ModelPostModel model)
        {
            var type = Type.GetType($"{model.FullType},{model.ThisAssembly}");

            if (type == null)
            {
                return;
            }
            var target = Read <IInt64Key>(type, b => b.Id == model.Id, out ISave repo).FirstOrDefault();

            if (target == null)
            {
                return;
            }
            model.ConvertToBaseModel(target);
            try
            {
                repo.SaveChanges();
            }
            catch { }
        }
Esempio n. 6
0
 public static void Create(ModelPostModel model)
 {
     BaseModelCRUD.Create(model);
 }
Esempio n. 7
0
 public static void Update(ModelPostModel model)
 {
     BaseModelCRUD.Update(model);
 }
Esempio n. 8
0
        public static void Create(ModelPostModel model)
        {
            var obj = model.ConvertToBaseModel();

            Create(obj);
        }
Esempio n. 9
0
        public ActionResult Edit(ModelPostModel model)
        {
            var e2 = model.ConvertToBaseModel() as E2;

            return(Json(e2));
        }