Example #1
0
 /// <summary>
 /// 获取所有数据
 /// </summary>
 /// <returns></returns>
 public static async Task <List <Models.Area> > GetAll()
 {
     using (var db = new DAL.AreaDAL())
     {
         return(await db.GetAll().ToListAsync());
     }
 }
Example #2
0
 /// <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));
     }
 }
Example #3
0
        /// <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);
            }
        }