捕捉MVC3的型号旧值? [英] Capturing old values for model in MVC3?

查看:113
本文介绍了捕捉MVC3的型号旧值?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想捕捉到一个模型中的旧值,以便我可以提交后的新值进行比较,并创造变化的审核日志的用户进行。

I'm wanting to capture the old values within a model so I can compare with the new values after submission, and create audit logs of changes a user makes.

我的猜测是与重复旧值的属性隐藏的输入框做这将是一种方式。但想知道是否有任何其他很好的选择?

My guess is doing it with hidden input boxes with duplicated old value properties would be one way. But wondering if there are any other good alternatives?

感谢

推荐答案

在保存方法,只是去和保存更改,那么你有你的旧数据库之前的获取原始对象新值进行比较? :)

In the save method, just go and get the original object from the database before saving the changes, then you have your old and new values to compare against? :)

这篇关于捕捉MVC3的型号旧值?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆