/// <summary> /// 获取全部数据 /// </summary> /// <returns></returns> public static async Task <List <Models.SealSystemList> > GetAllAsync() { using (var db = new DAL.SealSystemListDAL()) { return(await db.GetAll().ToListAsync()); } }
/// <summary> /// 根据name获取下拉列表数据 /// </summary> /// <param name="name"></param> /// <returns></returns> public static async Task <List <string> > GetForNameAsync(string name) { using (var db = new DAL.SealSystemListDAL()) { List <string> list = new List <string>(); var data = await db.GetAll().Where(m => m.Name == name).ToListAsync(); foreach (Models.SealSystemList item in data) { list.Add(item.Types); } return(list); } }
/// <summary> /// 根据id修改相应的数据 /// </summary> /// <param name="id"></param> /// <param name="model"></param> /// <returns></returns> public static async Task EditAsync(int id, Models.SealSystemList model) { using (var db = new DAL.SealSystemListDAL()) { var data = await db.GetAll().FirstAsync(m => m.Id == id); data.Name = model.Name; data.Note = model.Note; data.Code = model.Code; data.CreateTime = DateTime.Now; data.Types = model.Types; await db.EditAsync(data); } }