Пример #1
0
        public async Task <bool> Update(HelixEvent requestItem)
        {
            HelixEvent helixEventItem = await GetById(requestItem.HelixEventId);

            if (helixEventItem != null)
            {
                /// Update the existing event
                helixEventItem.Timestamp = DateTime.Now;
            }
            else
            {
                _dbContext.HelixEvents.Add(requestItem);
            }

            try
            {
                _dbContext.SaveChanges();
            }
            catch (Exception)
            {
                throw;
            }

            return(true);
        }
Пример #2
0
        public async Task <HelixEvent> GetById(long id)
        {
            HelixEvent helixEventItem = null;

            if (_dbContext.HelixEvents != null)
            {
                if (_dbContext.HelixEvents.Count() != 0)
                {
                    helixEventItem = await _dbContext.HelixEvents.FindAsync(id);
                }
            }

            return(helixEventItem);
        }