Epiworx.Business.AttachmentRepository.AttachmentUpdate C# (CSharp) Method

AttachmentUpdate() public static method

public static AttachmentUpdate ( Attachment attachment ) : Attachment
attachment Attachment
return Attachment
        public static Attachment AttachmentUpdate(Attachment attachment)
        {
            if (!attachment.IsDirty)
            {
                return attachment;
            }

            attachment = attachment.Save();

            return attachment;
        }

Usage Example

        public static Attachment AttachmentSave(Attachment attachment)
        {
            if (!attachment.IsValid)
            {
                return(attachment);
            }

            Attachment result;

            if (attachment.IsNew)
            {
                result = AttachmentRepository.AttachmentInsert(attachment);
            }
            else
            {
                result = AttachmentRepository.AttachmentUpdate(attachment);
            }

            return(result);
        }