Ejemplo n.º 1
0
        public IActionResult Post([FromBody] MetadataEntity value)
        {
            string currentUser = HttpContext.User.Identity.Name;

            if (!_securityRepository.UserIsAuthorisedByBuisnessAreas(HttpContext, AuthActions.Create, value.BuisnessArea))
            {
                return(_securityRepository.GateUnathorised(currentUser, AccessLogAction.DocumentMetadataCreate, "Metadata", "N/A"));
            }

            _metadataRepository.AddNew(ref value, currentUser);

            _logger.Log(LogLevel.Debug, "DocumentMetadata {0} Created By {1}", value.Id, currentUser);
            _securityRepository.LogUserAction(currentUser, AccessLogAction.DocumentMetadataCreate, value.Id, "Metadata", true);

            _metadataRepository.SaveChanges();

            return(Ok(value));
        }