public static ModelPostModel ConvertModelToModelPostModel(this object input) { var model = new ModelPostModel(); ConvertToIPost(input, model); return(model); }
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 })); }
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 })); }
public Task CreateOrUpdate(ModelPostModel model) { return(Task.Run(() => { try { if (model.Id <= 0) { Create(model); } else { Update(model); } } catch { } })); }
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 { } }
public static void Create(ModelPostModel model) { BaseModelCRUD.Create(model); }
public static void Update(ModelPostModel model) { BaseModelCRUD.Update(model); }
public static void Create(ModelPostModel model) { var obj = model.ConvertToBaseModel(); Create(obj); }
public ActionResult Edit(ModelPostModel model) { var e2 = model.ConvertToBaseModel() as E2; return(Json(e2)); }