一样写啊...
比如DAL层:
1
2
3
4
5
|
Public void Update(XXXXX.Models.News model) { db.Entry(XXXXX.Models.News).State = EntityState.Modified; db.SaveChanges(); } |
BLL
1
2
3
4
5
|
Public void Update(XXXXX.Models.News model) { ///一堆条件....... return Update(model); } |
Controllers
1
2
3
4
5
6
7
|
[HttpPost] Pubic ActionResult( int ? id) { var model = db.News.Find(id); Update(model); return View(); } |