1 /// <summary>
2 /// 修改记录
3 /// </summary>
4 /// <param name="info"></param>
5 /// <returns></returns>
6 public bool Update(News info)
7 {
8 bool flag = false;
9 using (model as IDisposable)
10 {
11 var selected = from x in model.News where x.ID == info.ID select x;
12 News row = selected.FirstOrDefault();
13 row.Title = info.Title;
14 row.SubTitle = info.SubTitle;
15 row.Advice = info.Advice;
16 row.Content = info.Content;
17 row.UpdateTime = info.UpdateTime;
18 row.Description = info.Description;
19 row.Enabled = info.Enabled;
20 row.FiledC1 = info.FiledC1;
21 row.FiledC2 = info.FiledC2;
22 row.FiledI1 = info.FiledI1;
23 row.FiledI2 = info.FiledI2;
24 row.Image = info.Image;
25 row.Keywords = info.Keywords;
26 row.LinkUrl = info.LinkUrl;
27 row.Sort = info.Sort;
28 row.Summary = info.Summary;
29 row.Top = info.Top;
30 row.TypeID = info.TypeID;
31 try
32 {
33 model.SubmitChanges();
34 flag = true;
35 }
36 catch (Exception)
37 {
38 flag = false;
39 }
40 }
41 return flag;
42 }
1 /// <summary>
2 /// 修改记录
3 /// </summary>
4 /// <param name="info"></param>
5 /// <returns></returns>
6 public bool Update(News info)
7 {
8 bool flag = false;
9 using (model as IDisposable)
10 {
11 var selected = from x in model.News where x.ID == info.ID select x;
12 News row = selected.FirstOrDefault();
13 row.Title = "ssssssssssssssssss"; //这里直接赋常量值便可以更新
14 row.SubTitle = info.SubTitle;
15 row.Advice = info.Advice;
16 row.Content = info.Content;
17 row.UpdateTime = info.UpdateTime;
18 row.Description = info.Description;
19 row.Enabled = info.Enabled;
20 row.FiledC1 = info.FiledC1;
21 row.FiledC2 = info.FiledC2;
22 row.FiledI1 = info.FiledI1;
23 row.FiledI2 = info.FiledI2;
24 row.Image = info.Image;
25 row.Keywords = info.Keywords;
26 row.LinkUrl = info.LinkUrl;
27 row.Sort = info.Sort;
28 row.Summary = info.Summary;
29 row.Top = info.Top;
30 row.TypeID = info.TypeID;
31 try
32 {
33 model.SubmitChanges();
34 flag = true;
35 }
36 catch (Exception)
37 {
38 flag = false;
39 }
40 }
41 return flag;
42 }