public List<Commod> GetAll() { using (RxjhEntities en = new RxjhEntities()) { return en.Commod.OrderBy(i => i.Price).ToList(); } }
public List<CommodConfig> GetAll() { using (RxjhEntities en = new RxjhEntities()) { return en.CommodConfig.ToList(); } }
public void Add(CommodConfig config) { using (RxjhEntities en = new RxjhEntities()) { config.ID = Guid.NewGuid(); en.CommodConfig.Add(config); en.SaveChanges(); } }
public DataAccesss.SystemConfig Get() { using (RxjhEntities en = new RxjhEntities()) { return en.SystemConfig.FirstOrDefault(); } }
public SystemConfig GetAll() { using (RxjhEntities en = new RxjhEntities()) { return en.SystemConfig.FirstOrDefault(); } }
/// <summary> /// 添加一个最低价格装备 /// 如果存在同一天的就修改价格 /// </summary> /// <param name="commod">要添加的装备</param> public void Add(Commod commod) { using (RxjhEntities en = new RxjhEntities()) { //先找到当天是否已经存在该装备 var thisDateCommod = en.Commod.Where(i => i.Name == commod.Name).FirstOrDefault(); //存在就更新 if (thisDateCommod != null) { en.Commod.Remove(thisDateCommod); commod.ID = Guid.NewGuid(); en.Commod.Add(commod); en.SaveChanges(); } else { commod.ID = Guid.NewGuid(); en.Commod.Add(commod); en.SaveChanges(); } } }