public ActionResult Save(EditCatalogModel model, int modelId) { CatalogModel tosave = Find(model.Catalogs, modelId); if (tosave != null) { model.Save(tosave, db, User.Identity.GetUserId()); } StaticData.Inst.Update(db); return(Json(model)); }
public ActionResult Delete(EditCatalogModel model, int modelId) { CatalogModel todel = Find(model.Catalogs, modelId); if (todel != null) { model.Delete(todel, db); } StaticData.Inst.Update(db); return(Json(model)); }
public ActionResult AddDependency(EditCatalogModel model, int parentId) { var dependency = new Catalog() { Code = Guid.NewGuid().ToString(), Ru = "Зависимость", Uk = "Залежність", DescRu = "", DescUk = "", ParentId = parentId, UserId = User.Identity.GetUserId() ?? null, }; db.Insert(dependency, User.Identity.GetUserId()); StaticData.Inst.Update(db); return(Json(CreateEditModel())); }
//public ActionResult Test() //{ // return View(CreateEditModel()); //} public ActionResult AddCatalog(EditCatalogModel model) { var catalog = new Catalog() { Code = Guid.NewGuid().ToString(), Ru = "Справочник", Uk = "Довідник", DescRu = "", DescUk = "", UserId = User.Identity.GetUserId() ?? null, }; db.Insert(catalog, User.Identity.GetUserId()); StaticData.Inst.Update(db); model.AddRoot(catalog); return(Json(model)); }