示例#1
0
        public static void Update(this BaseViewModel input)
        {
            var model = ModelManager.Find(input.ModelType(), input.Id, out ISave repo);

            if (model == null)
            {
                return;
            }
            input.ConvertToModel(model as IInt64Key);
            repo.SaveChanges();
        }
示例#2
0
        public static void Update(this BaseViewModel model)
        {
            var type = model.ModelType();

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

            if (baseModel == null)
            {
                return;
            }
            model.ConvertToModel(baseModel);
            try
            {
                repo.SaveChanges();
            }
            catch { }
        }