public void Create(string description, string propertyValue) { if (!propertyValue.HasValue()) Create(description, AuditLogType.JustDescription); var log = new AuditLog { Description =string.Format("{0} با مشخصه {1}",description,propertyValue), CreatorId = Guid.Parse(HttpContext.Current.User.Identity.GetUserId()), Type = AuditLogType.JustDescription }; _logs.Add(log); _unitOfWork.SaveChanges(); }
public void Create(string description, AuditLogType type) { var log = new AuditLog { Description = description, CreatorId =_userManager.GetCurrentUserId(), Type = type }; switch (type) { case AuditLogType.JustDescription: break; case AuditLogType.Serialize: log.NewValue = _unitOfWork.AuditNewValue; log.OldValue = _unitOfWork.AuditOldValue; log.RecordedEntityId = _unitOfWork.RecordedEntityKey; break; } _logs.Add(log); _unitOfWork.SaveChanges(); }