//create public int PreserveAttachment(PreserveAttachmentModel model) { if (!_authorization.Create(new AttachmentKeyModel { EntityName = model.EntityName, FieldName = model.FieldName, EntityId = model.EntityId })) { throw new UnauthorizedAccessException(); } return(_business.PreserveAttachment(model)); }
/// <summary> /// connect a temporarty atttachment to an actual entity id /// </summary> /// <param name="entityName"></param> /// <param name="fieldName"></param> /// <param name="token"></param> /// <param name="entityId"></param> /// <param name=""></param> /// <returns>attachmentId</returns> public int SetEntityId(string entityName, string fieldName, string entityId) { var token = tokenProvider.GetAttachmentToken(); if (!token.HasValue()) { throw new NullReferenceException("Attachment token don't have value"); } return(attachmentBusiness.PreserveAttachment(new PreserveAttachmentModel { EntityName = entityName, FieldName = fieldName, Token = token, EntityId = entityId })); }