EFCoreWebAPI.Controllers.WeatherController.LogWeatherEvent C# (CSharp) Méthode

LogWeatherEvent() private méthode

private LogWeatherEvent ( System.DateTime datetime, WeatherType type, bool happy, string name, string quote ) : int
datetime System.DateTime
type WeatherType
happy bool
name string
quote string
Résultat int
        public int LogWeatherEvent(DateTime datetime, WeatherType type, bool happy,
                                        string name, string quote)
        {
            
            //This controller method demonstrates that DbSet Add behaves the same
            //as EF6: affecting every item in a [disconnected] graph with the same state
            //As well as Attach, Remove and the new Update.
            
            WeatherEvent wE;
            if (String.IsNullOrEmpty(name))
            {
                wE = WeatherEvent.Create(datetime, type, happy);
            }
            else
            {
                wE = WeatherEvent.Create(datetime, type, happy,
                                         new List<string[]> { new[] { name, quote } });
            }
             _context.WeatherEvents.Add(wE);
            var affectedRowCount = _context.SaveChanges();
            return affectedRowCount;
        }