/// <summary> /// /// </summary> /// <param name="r"></param> public void Update(Alerts.Rule r) { Name = r.Name; Frequency = ( int )DateTimeMathParser.ToDuration(r.Frequency); Settings = JsonConvert.SerializeObject(r, new JsonSerializerSettings { NullValueHandling = NullValueHandling.Ignore, Formatting = Formatting.Indented }); }
/// <summary> /// /// </summary> /// <param name="ds"></param> /// <returns></returns> public static Alert ToEntity(this Alerts.Rule r) { var alert = new Alert() { PanelId = r.PanelId, NewStateDate = DateTime.Now }; alert.Update(r); return(alert); }