You should install antivirus on your endpoint (i.e. PC). Enterprise class NAS appliance usually will not allow you to install antivirus software on it. However, some NAS is able to integrate with external antivirus software for realtime scanning, i.e receiving and sending out a file. Ransomware should be detected at you endpoint. Snapshot feature and backup will help you to recover your files.