コード例 #1
0
 public bool Update(int updateId, CountdownItem updateItem)
 {
     try
     {
         CountdownItem itemToBeUpdated = _ctx.Countdowns.FirstOrDefault(t => t.Id == updateId);
         itemToBeUpdated.Event = updateItem.Event;
         itemToBeUpdated.EventDate = updateItem.EventDate;
         itemToBeUpdated.TileColor = updateItem.TileColor;
         itemToBeUpdated.FontColor = updateItem.FontColor;
         return true;
     }
     catch (Exception ex)
     {
         //TODO Log error
         return false;
     }
 }
コード例 #2
0
        public bool AddCountdownItem(CountdownItem newItem)
        {
            if (string.IsNullOrEmpty(newItem.TileColor))
            {
                newItem.TileColor = defaultTileColor;
            }
            if (string.IsNullOrEmpty(newItem.FontColor))
            {
                newItem.FontColor = defaultFontColor;
            }
            try
            {
                _ctx.Countdowns.Add(newItem);
                return true;

            }
            catch (Exception ex)
            {
                //TODO Log error
                return false;
            }
        }