Ejemplo n.º 1
0
        public async Task <bool> Create(SLAAlertMail SLAAlertMail)
        {
            SLAAlertMailDAO SLAAlertMailDAO = new SLAAlertMailDAO();

            SLAAlertMailDAO.Id         = SLAAlertMail.Id;
            SLAAlertMailDAO.SLAAlertId = SLAAlertMail.SLAAlertId;
            SLAAlertMailDAO.Mail       = SLAAlertMail.Mail;
            SLAAlertMailDAO.CreatedAt  = StaticParams.DateTimeNow;
            SLAAlertMailDAO.UpdatedAt  = StaticParams.DateTimeNow;
            DataContext.SLAAlertMail.Add(SLAAlertMailDAO);
            await DataContext.SaveChangesAsync();

            SLAAlertMail.Id = SLAAlertMailDAO.Id;
            await SaveReference(SLAAlertMail);

            return(true);
        }
Ejemplo n.º 2
0
        public async Task <bool> BulkMerge(List <SLAAlertMail> SLAAlertMails)
        {
            List <SLAAlertMailDAO> SLAAlertMailDAOs = new List <SLAAlertMailDAO>();

            foreach (SLAAlertMail SLAAlertMail in SLAAlertMails)
            {
                SLAAlertMailDAO SLAAlertMailDAO = new SLAAlertMailDAO();
                SLAAlertMailDAO.Id         = SLAAlertMail.Id;
                SLAAlertMailDAO.SLAAlertId = SLAAlertMail.SLAAlertId;
                SLAAlertMailDAO.Mail       = SLAAlertMail.Mail;
                SLAAlertMailDAO.CreatedAt  = StaticParams.DateTimeNow;
                SLAAlertMailDAO.UpdatedAt  = StaticParams.DateTimeNow;
                SLAAlertMailDAOs.Add(SLAAlertMailDAO);
            }
            await DataContext.BulkMergeAsync(SLAAlertMailDAOs);

            return(true);
        }
Ejemplo n.º 3
0
        public async Task <bool> Update(SLAAlertMail SLAAlertMail)
        {
            SLAAlertMailDAO SLAAlertMailDAO = DataContext.SLAAlertMail.Where(x => x.Id == SLAAlertMail.Id).FirstOrDefault();

            if (SLAAlertMailDAO == null)
            {
                return(false);
            }
            SLAAlertMailDAO.Id         = SLAAlertMail.Id;
            SLAAlertMailDAO.SLAAlertId = SLAAlertMail.SLAAlertId;
            SLAAlertMailDAO.Mail       = SLAAlertMail.Mail;
            SLAAlertMailDAO.UpdatedAt  = StaticParams.DateTimeNow;
            await DataContext.SaveChangesAsync();

            await SaveReference(SLAAlertMail);

            return(true);
        }