/// <summary> /// 批量新增 /// </summary> /// <param name="entities"></param> public void Insert(IEnumerable <T> entities) { foreach (var item in entities) { _baseRepostory.Insert(item); } }
public int AddUserInfo(string userName, string pwd) { UserInfo user = new UserInfo { UserName = userName, Pwd = pwd, State = EnumState.IsOffline.GetHashCode(), StateName = EnumHelper.GetDescription(EnumState.IsLogined) }; return(_userRespostitory.Insert(user)); }
/// <summary> /// 新增礼包 /// </summary> /// <param name="loginUser"></param> /// <returns></returns> public int AddandUpdateGift(GiftBaseData giftData) { if (_giftRespostitory.GetList(m => m.GiftName == giftData.GiftName).Count == 0) { return(_giftRespostitory.Insert(giftData)); } else { var model = _giftRespostitory.GetList(m => m.GiftName == giftData.GiftName).FirstOrDefault(); model.GiftName = giftData.GiftName; model.GiftStatus = giftData.GiftStatus; model.GiftType = giftData.GiftType; model.GiftStatusName = giftData.GiftStatusName; model.GiftTypeName = giftData.GiftTypeName; model.PlateForm = giftData.PlateForm; model.Url = giftData.Url; model.ValidateTime = giftData.ValidateTime; model.Remain = giftData.Remain; _giftRespostitory.Update(model); return(1); } }