public void Post([FromBody] AlertModel value)
        {
            var alert = new AlertDomain();

            alert.AddAlertDetails(value.AlertName, value.CreatedBy, value.CreatedDateTime);
            AlertRepository.AddAlertDetails(alert);
        }
        private IEnumerable <AlertDomain> Mapper(IEnumerable <dynamic> alerts)
        {
            IList <AlertDomain> domainData = new List <AlertDomain>();

            foreach (var item in alerts)
            {
                var alertDomain = new AlertDomain(Convert.ToInt64(item.AlertID.Value));
                alertDomain.AddAlertDetails(item.AlertName.Value, item.CreatedBy.Value, DateTime.Parse(item.CreatedDateTime.Value));
                domainData.Add(alertDomain);
            }
            return(domainData);
        }
        public void AddAlertDetails(AlertDomain alertDomain)
        {
            var data   = File.ReadAllText(FilePath);
            var alerts = JsonConvert.DeserializeObject <IList <dynamic> >(data).ToList();

            //expected auto mapper
            dynamic newalert = new ExpandoObject();

            newalert.AlertID         = alertDomain.AlertID;
            newalert.AlertName       = alertDomain.AlertName;
            newalert.CreatedBy       = alertDomain.CreatedBy;
            newalert.CreatedDateTime = alertDomain.CreatedDateTime.Value.ToString();
            alerts.Add(newalert);
            var newdata = JsonConvert.SerializeObject(alerts);

            File.WriteAllText(FilePath, newdata);
        }