/// <summary> /// 获取所有数据 /// </summary> /// <returns></returns> public static async Task <List <Models.Area> > GetAll() { using (var db = new DAL.AreaDAL()) { return(await db.GetAll().ToListAsync()); } }
/// <summary> /// 根据区域代码查找相应的数据 /// </summary> /// <returns></returns> public static async Task <Models.Area> GetAllForCode(string code) { using (var db = new DAL.AreaDAL()) { return(await db.GetAll().FirstAsync(m => m.Code == code)); } }
/// <summary> /// 根据id修改地区区域 /// </summary> /// <param name="id"></param> /// <param name="name"></param> /// <returns></returns> public static async Task SetArea(int id, Models.Area model) { using (var db = new DAL.AreaDAL()) { var data = await db.GetAll().FirstAsync(m => m.Id == id); await db.EditAsync(data); } }