コード例 #1
0
        public static async Task AddAsync(string stopCode, string name)
        {
            History history = new History
            {
                StopCode  = stopCode,
                Name      = name,
                TimeStamp = DateTime.Now
            };

            await TramlineFiveContext.AddAsync(history);

            HistoryAdded?.Invoke(new HistoryDomain(history), new EventArgs());
        }
コード例 #2
0
        public static async Task <FavouriteDomain> AddAsync(string name, string stopCode)
        {
            if ((await TramlineFiveContext.FindFavouriteAsync(stopCode)) != null)
            {
                return(null);
            }

            Favourite added = new Favourite
            {
                Name     = name,
                StopCode = stopCode
            };

            await TramlineFiveContext.AddAsync(added);

            return(new FavouriteDomain(added));
        }