public static Message Update(Area info) { Message msg = new Message(); if (AreaService.Update(info) > 0) { msg.Type = MessageType.None; msg.Text = "保存管理员信息成功!"; } else { msg.Type = MessageType.Error; msg.Text = "保存管理员信息失败,请重新尝试!"; } return msg; }
public static int Update(Area info) { DatabaseEntities de = new DatabaseEntities(); var obj = (from item in de.Area where item.SysNo == info.SysNo select item).FirstOrDefault(); if (obj != null) { obj.Parent = info.Parent; obj.Priority = info.Priority; obj.Title = info.Title; return de.SaveChanges(); } return 0; }
public static int Insert(Area info) { DatabaseEntities de = new DatabaseEntities(); de.Area.Add(info); return de.SaveChanges(); }