Exemplo n.º 1
0
        public void AddCustomReport(CustomReportsViewModel model)
        {
            CustomReport report = new CustomReport
            {
                DateCreated        = DateTime.Now,
                IsActive           = true,
                ReportName         = model.ReportName,
                ReportQuery        = model.ReportQuery,
                CustomReportTypeID = model.CustomReportTypeID
            };

            ContextPerRequest.CurrentData.CustomReports.Add(report);
            ContextPerRequest.CurrentData.SaveChanges();
        }
Exemplo n.º 2
0
        public void EditCustomReport(CustomReportsViewModel model)
        {
            var data = (from report in ContextPerRequest.CurrentData.CustomReports
                        where report.CustomReportID == model.CustomReportID
                        select report).FirstOrDefault();

            if (data != null)
            {
                data.IsActive           = model.IsActive;
                data.ReportName         = model.ReportName;
                data.ReportQuery        = model.ReportQuery;
                data.CustomReportTypeID = model.CustomReportTypeID;
                ContextPerRequest.CurrentData.SaveChanges();
            }
        }