public ConsumeThingEntity GetByType(ConsumeThingType type) { using (var context = ContextProvider.Provide()) { return(context.ConsumeThings.FirstOrDefault(s => s.Type == type)); } }
public bool Consume(ConsumeThingType thingType) { var thing = _consumeThingSearchRepository.GetByType(thingType); var subscriberId = UserContext.Current.SubscriberId; var fund = _fundRepository.First(subscriberId); var passportId = UserContext.Current.UserId; var consume = CreateConsumeEntity(fund, passportId, thing); if (_consumeAddRepository.AddEntity(consume)) { return(_fundUpdateRepository.MinusBalance(subscriberId, thing.Price)); } return(false); }
public ConsumeAttribute(ConsumeThingType thingType) { ThingType = thingType; }