Beispiel #1
0
        public DtoActionResult Put(int id, EntityPolicy policy)
        {
            policy.Id = id;
            var result = _policyServices.UpdatePolicy(policy);

            if (result == null)
            {
                throw new HttpResponseException(Request.CreateResponse(HttpStatusCode.NotFound));
            }
            if (result.Success)
            {
                var auditLog = new EntityAuditLog();
                auditLog.ObjectType = "Policy";
                auditLog.ObjectId   = result.Id;
                auditLog.ObjectName = policy.Name;
                auditLog.ObjectJson = JsonConvert.SerializeObject(policy);
                auditLog.UserId     = _userId;
                auditLog.AuditType  = EnumAuditEntry.AuditType.Update;
                _auditLogService.AddAuditLog(auditLog);
            }
            return(result);
        }