public void UpdateChit(Model.Chitatel p) { DAL.Chitatel tmp = db.Chitatel.GetItem(p.Id); tmp.Nomer_chit = p.Nomer_chit; tmp.FIO = p.FIO; tmp.Status_id = p.Status_id; tmp.Telephone = p.Telephone; tmp.Adress = p.Adress; db.Chitatel.Update(tmp); Save(); //db.Chitatel.Update(new DAL.Chitatel {Id=p.Id,FIO=p.FIO,Nomer_chit=p.Nomer_chit,Adress=p.Adress,Telephone=p.Telephone,Status_id=p.Status_id }); }
public void Refresh_stat(List <Model.Chitatel> list) { for (int i = 0; i < list.Count; i++) { int st_id = 2; foreach (Model.Book tmp in list[i].BookList) { int d = (DateTime.Now - list[i].OutList.FindLast(j => j.Id_book == tmp.Id).Date).Days; if (d >= 1) { st_id = 1; } } DAL.Chitatel tmp1 = db.Chitatel.GetItem(list[i].Id); tmp1.Status_id = st_id; db.Chitatel.Update(tmp1); } }