示例#1
0
        public ActionResult Create(AuditHistrory audithistrory)
        {
            if (ModelState.IsValid)
            {
                db.AuditHistrories.AddObject(audithistrory);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.AppEntityID = new SelectList(db.AppEntities, "AppEntityID", "AppEntityID", audithistrory.AppEntityID);
            return(View(audithistrory));
        }
示例#2
0
        public bool InsertAudit(AuditModel Audit)
        {
            bool result = false;

            try
            {
                using (AuditEntities auditEntities = new AuditEntities())
                {
                    var config = new MapperConfiguration(
                        cfg =>
                    {
                        cfg.CreateMap <AuditModel, Audit>();
                    }
                        );

                    var mapper = config.CreateMapper();
                    var audit  = mapper.Map <Audit>(Audit);
                    auditEntities.Audits.Add(audit);
                    auditEntities.SaveChanges();
                }

                result = true;
            }
            catch (Exception ex)
            {
                var log = new Logger();
                log.LogError(Audit.UserID.ToString(), "DataSolutions.Data", "InsertAudit", ex.Message);
            }

            return(result);
        }